Skip to content

Update config to override correct URL#3727

Merged
MDrakos merged 2 commits intomasterfrom
CP-1054-follow-up
Sep 3, 2025
Merged

Update config to override correct URL#3727
MDrakos merged 2 commits intomasterfrom
CP-1054-follow-up

Conversation

@MDrakos
Copy link
Copy Markdown
Member

@MDrakos MDrakos commented Sep 3, 2025

StoryCP-1054 The update url can be configured with `state config`

In the previous PR I mistakenly used the config value to override the update info endpoint. I still think we need that, however the story calls for this config value to override the update endpoint. I've added another config value specifically for the update info endpoint and repurposed the original one for the indented use case.

Integration test failures appear to be unrelated to this PR as the same failures are happening on the nightly tests.

Comment thread internal/updater/updater.go Outdated
func getAPIUpdateURL(cfg Configurable, path string) string {
var apiUpdateURL string

envUrl := os.Getenv("_TEST_UPDATE_URL")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This doesn't feel like something we do. We usually have a constant that contains an override env var we can use for testing. What do you think about doing that here?

Comment thread test/integration/update_int_test.go Outdated
cp = ts.SpawnWithOpts(
e2e.OptArgs("update"),
e2e.OptAppendEnv(suite.env(false, false)...),
e2e.OptAppendEnv("VERBOSE=true"),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Note: we can use the "-v" parameter to enable verbose logging. I fixed it late last year or earlier this year.

e2e.OptAppendEnv(suite.env(false, false)...),
e2e.OptAppendEnv("VERBOSE=true"),
)
cp.ExpectExitCode(11) // Expect failure due to DNS resolution of fake host
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If an error will be logged, then we also need to call ts.IgnoreLogErrors().

The nightly integration tests scan the logs for errors and fail tests if errors are found unless we expect to have them.

mitchell-as
mitchell-as previously approved these changes Sep 3, 2025
Copy link
Copy Markdown
Collaborator

@mitchell-as mitchell-as left a comment

Choose a reason for hiding this comment

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

I saw another instance of a magic env var that we can either address now or file a follow up for. It's up to you.

Comment thread internal/updater/checker.go Outdated
@@ -87,7 +87,7 @@ func (u *Checker) infoURL(tag, desiredVersion, branchName, platform, arch string
infoURL string

envUrl = os.Getenv("_TEST_UPDATE_INFO_URL")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sorry, I just saw this. Can we change this env var to use a constant too? If you don't want to, then please file a follow-up ticket.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thank you for catching that! 🙏

@MDrakos MDrakos merged commit 71ecc83 into master Sep 3, 2025
8 of 13 checks passed
@MDrakos MDrakos deleted the CP-1054-follow-up branch September 3, 2025 21:24
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.

2 participants