Skip to content

Conversation

@kukushechkin
Copy link
Contributor

Refactor tests to only use InstrumentationSystem global state bootstrapping where necessary.

Motivation:

Decoupling tests from the global state allows running them in parallel later on within Swift Testing.

Modifications:

  • Use local tracer variable instead of calling InstrumentationSystem.bootstrapInternal()
  • Add tests specifically for global withSpan()-like methods

Result:

Most of the tests no longer rely on the global InstrumentationSystem state. Test coverage is up slightly.

@kukushechkin kukushechkin added the 🔨 semver/patch No public API change. label Oct 29, 2025
@kukushechkin kukushechkin marked this pull request as ready for review October 29, 2025 11:13
Copy link
Member

@ktoso ktoso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, lgtm 👍

@ktoso ktoso enabled auto-merge (squash) October 29, 2025 11:45
@ktoso
Copy link
Member

ktoso commented Oct 29, 2025

Technically this is "semver/none" not patch I guess, no real functionality touched at all

@ktoso ktoso added semver/none No version bump required. and removed 🔨 semver/patch No public API change. labels Oct 29, 2025
@ktoso ktoso merged commit af4069a into apple:main Oct 29, 2025
43 checks passed
@kukushechkin kukushechkin deleted the avoid-global-state-in-tests branch October 29, 2025 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver/none No version bump required.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants