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

[tests] Tests should not modify config #883

Merged
merged 3 commits into from
Apr 11, 2023

Conversation

mikeland73
Copy link
Contributor

Summary

This allows us to run tests without modifying example devbox.json configs.

How was it tested?

go test ./...

@mikeland73 mikeland73 requested review from savil and ipince April 10, 2023 18:45
Copy link
Collaborator

@savil savil left a comment

Choose a reason for hiding this comment

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

approving but please see inline and lets try to verify its using the correct nixpkgs commit hash

os.Getenv("DEVBOX_DONT_UPGRADE_CONFIG"),
); dontUpgrade {
return nil
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm surprised this works. Does it actually use our desired defaultNixPkgsCommit? or just nixpkgs and "seem to work" because tests happen to pass?

I would have thought you want to just gate the writeConfig below, but continue to write:

cfg.Nixpkgs.Commit = plansdk.DefaultNixpkgsCommit

so that the code works as we want by using the DefaultNixpkgsCommit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The code correctly defaults to DefaultNixpkgsCommit if none is set.

Gating writeConfig felt wrong because what is specifically causing the writes is the upgrade. (This may change if we decide to add packages dynamically, but in that case gating writeConfig will break that).

I actually was thinking of adding something to the test that confirms that devbox.json has not changed (since it should not)

@mikeland73 mikeland73 merged commit f9a1109 into main Apr 11, 2023
9 checks passed
@mikeland73 mikeland73 deleted the landau/tests-should-not-change-config branch April 11, 2023 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants