Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore][cmd/builder] Improve missing replace statements test #10196

Merged

Conversation

evan-bradley
Copy link
Contributor

Description

Updates TestReplaceStatementsAreComplete to check the modules used in replace statements to ensure that their dependencies also have replace statements. This will catch the error that happened in #10188 before a release is started.

The one caveat here is that the test may need to be run multiple times if there are modules deep in the dependency tree that haven't been added to the list of replace statement modules. In essence, the user has to do a BFS walk of the dependency tree themselves by running the tests until all missing modules are caught. We could automate this process with additional code to report all missing modules at once regardless of depth, but I figure it's not worth the extra complexity in the test for such a small gain.

Testing

I tested this on the #10188 branch by removing the pdata/testdata module from the replace statements list and seeing that the failure is easier to understand:

--- FAIL: TestReplaceStatementsAreComplete (0.60s)
        	Error:      	Should be true
        	Test:       	TestReplaceStatementsAreComplete
        	Messages:   	Module missing from replace statements list: go.opentelemetry.io/collector/pdata/testdata

@evan-bradley evan-bradley requested a review from a team as a code owner May 21, 2024 16:24
Copy link

codecov bot commented May 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.90%. Comparing base (b1579a5) to head (3d94ac7).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10196   +/-   ##
=======================================
  Coverage   91.90%   91.90%           
=======================================
  Files         361      361           
  Lines       16970    16970           
=======================================
  Hits        15596    15596           
  Misses       1032     1032           
  Partials      342      342           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codeboten codeboten merged commit 1c7715c into open-telemetry:main May 21, 2024
49 checks passed
@github-actions github-actions bot added this to the next release milestone May 21, 2024
andrzej-stencel pushed a commit to andrzej-stencel/opentelemetry-collector that referenced this pull request May 27, 2024
…lemetry#10196)

Updates `TestReplaceStatementsAreComplete` to check the modules used in
replace statements to ensure that their dependencies also have replace
statements. This will catch the error that happened in open-telemetry#10188 before a
release is started.

The one caveat here is that the test may need to be run multiple times
if there are modules deep in the dependency tree that haven't been added
to the list of replace statement modules. In essence, the user has to do
a BFS walk of the dependency tree themselves by running the tests until
all missing modules are caught. We could automate this process with
additional code to report all missing modules at once regardless of
depth, but I figure it's not worth the extra complexity in the test for
such a small gain.

#### Testing

I tested this on the open-telemetry#10188 branch by removing the `pdata/testdata`
module from the replace statements list and seeing that the failure is
easier to understand:

```
--- FAIL: TestReplaceStatementsAreComplete (0.60s)
        	Error:      	Should be true
        	Test:       	TestReplaceStatementsAreComplete
        	Messages:   	Module missing from replace statements list: go.opentelemetry.io/collector/pdata/testdata
```
steves-canva pushed a commit to Canva/opentelemetry-collector that referenced this pull request Jun 14, 2024
…lemetry#10196)

Updates `TestReplaceStatementsAreComplete` to check the modules used in
replace statements to ensure that their dependencies also have replace
statements. This will catch the error that happened in open-telemetry#10188 before a
release is started.

The one caveat here is that the test may need to be run multiple times
if there are modules deep in the dependency tree that haven't been added
to the list of replace statement modules. In essence, the user has to do
a BFS walk of the dependency tree themselves by running the tests until
all missing modules are caught. We could automate this process with
additional code to report all missing modules at once regardless of
depth, but I figure it's not worth the extra complexity in the test for
such a small gain.

#### Testing

I tested this on the open-telemetry#10188 branch by removing the `pdata/testdata`
module from the replace statements list and seeing that the failure is
easier to understand:

```
--- FAIL: TestReplaceStatementsAreComplete (0.60s)
        	Error:      	Should be true
        	Test:       	TestReplaceStatementsAreComplete
        	Messages:   	Module missing from replace statements list: go.opentelemetry.io/collector/pdata/testdata
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants