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

Fix integration tests #1853

Merged
merged 81 commits into from May 17, 2022
Merged

Fix integration tests #1853

merged 81 commits into from May 17, 2022

Conversation

Naatan
Copy link
Member

@Naatan Naatan commented May 6, 2022

BugDX-925 Fix failing integration tests

@Naatan Naatan requested a review from MDrakos May 16, 2022 16:45
MDrakos
MDrakos previously approved these changes May 16, 2022
Copy link
Member

@MDrakos MDrakos left a comment

Choose a reason for hiding this comment

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

Looks good to me overall. Lots of convenient changes here.

My comments are mostly just questions and nits.

@@ -180,6 +185,7 @@ func new(t *testing.T, retainDirs, updatePath bool, extraEnv ...string) *Session
constants.ProjectEnvVarName + "=",
constants.E2ETestEnvVarName + "=true",
constants.DisableUpdates + "=true",
constants.OptinUnstableEnvVarName + "=true",
Copy link
Member

Choose a reason for hiding this comment

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

Can we still overwrite this environment in a test? Just want to make sure we can test unstable commands not working if you haven't opted in

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, to overwrite you just specify the env var with an empty value. Or really any value other than true.

@@ -45,6 +45,7 @@ func init() {
if locale == "" {
cfg, err := config.New()
if err == nil {
defer cfg.Close()
Copy link
Member

Choose a reason for hiding this comment

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

Should we use the closer here so any close errors are logged?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is an init function, so logging may not be available. I'd rather not risk making this a bigger issue than it needs to be, especially considering long term we'd be getting rid of this init function anyway.

deprecated, err := r.deprecation.Check()
if err != nil {
return nil, errs.Wrap(err, "Could not fetch deprecation information")
deprecated, ok := r.depPoller.ValueFromCache().(*graph.DeprecationInfo)
Copy link
Member

Choose a reason for hiding this comment

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

This won't panic if the value from ValueFromCache() is nil right? I'm pretty sure it won't. Might be something nice to confirm in the unit test for the poller

Copy link
Member Author

Choose a reason for hiding this comment

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

I can't confirm it in the poller, because the value type is an interface and we can't reliably assert nil unless we know the type.

We're not doing anything with the returned value here, other than also return it. And as per the contract of the function it CAN return a nil, which isn't a new change.

Comment on lines +60 to +61
baseDir := filepath.Join(tempPath, constants.ToplevelInstallArchiveDir)
stateExec := filepath.Join(baseDir, installation.BinDirName, constants.StateCmd+osutils.ExeExt)
Copy link
Member

Choose a reason for hiding this comment

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

This should work with installation.StateExecFromDir and I'm pretty sure it was in the PR that moved appinfo. What changed?

Copy link
Member Author

Choose a reason for hiding this comment

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

That function is for using information from the installed state tool. This test is using a generated payload. While those are similar things they are not the same.

I believe in this case it would fail because the payload has no install dir marker.

# Conflicts:
#	cmd/state-svc/internal/deprecation/deprecation.go
#	cmd/state-svc/internal/resolver/resolver.go
#	internal/constants/constants.go
@Naatan Naatan merged commit 3e81c83 into master May 17, 2022
@Naatan Naatan deleted the DX-925 branch May 17, 2022 17:14
Naatan added a commit that referenced this pull request May 26, 2022
Fix integration tests
# Conflicts:
#	.github/workflows/build.yml
#	cmd/state-installer/installer.go
#	internal/locale/locales/en-us.yaml
#	internal/testhelpers/e2e/session.go
#	test/integration/upgen_int_test.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants