-
Notifications
You must be signed in to change notification settings - Fork 14
Allow configuration of update URL #3720
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
Changes from all commits
f1be3a6
c82282b
76b6d5c
2d881b4
34d5366
eaf5bf1
165658b
6688d6c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -275,6 +275,61 @@ func (suite *UpdateIntegrationTestSuite) TestUpdateTags() { | |
| } | ||
| } | ||
|
|
||
| func (suite *UpdateIntegrationTestSuite) TestUpdateHost_SetBeforeInvocation() { | ||
| suite.OnlyRunForTags(tagsuite.Update) | ||
|
|
||
| ts := e2e.New(suite.T(), false) | ||
| defer ts.Close() | ||
|
|
||
| ts.SetConfig(constants.UpdateEndpointConfig, "https://test.example.com/update") | ||
| suite.Assert().Equal(ts.GetConfig(constants.UpdateEndpointConfig), "https://test.example.com/update") | ||
|
|
||
| cp := ts.SpawnWithOpts( | ||
| e2e.OptArgs("--version"), | ||
| ) | ||
| cp.ExpectExitCode(0) | ||
|
|
||
| correctHostCount := 0 | ||
| incorrectHostCount := 0 | ||
| for _, path := range ts.LogFiles() { | ||
| contents := string(fileutils.ReadFileUnsafe(path)) | ||
| if strings.Contains(contents, "https://test.example.com/update") { | ||
| correctHostCount++ | ||
| } | ||
| if strings.Contains(contents, "https://platform.activestate.com/update") { | ||
| incorrectHostCount++ | ||
| } | ||
| } | ||
| suite.Assert().Greater(correctHostCount, 0, "Log file should contain the configured API host 'test.example.com'") | ||
| suite.Assert().Equal(incorrectHostCount, 0, "Log file should not contain the default API host 'platform.activestate.com'") | ||
|
|
||
| // Clean up - remove the config setting | ||
| cp = ts.Spawn("config", "set", constants.UpdateEndpointConfig, "") | ||
| cp.Expect("Successfully") | ||
| cp.ExpectExitCode(0) | ||
| } | ||
|
|
||
| func (suite *UpdateIntegrationTestSuite) TestUpdateHost() { | ||
| suite.OnlyRunForTags(tagsuite.Update) | ||
|
|
||
| ts := e2e.New(suite.T(), false) | ||
| defer ts.Close() | ||
|
|
||
| cp := ts.Spawn("config", "set", constants.UpdateEndpointConfig, "https://example.com/update") | ||
| cp.Expect("Successfully set config key") | ||
| cp.ExpectExitCode(0) | ||
|
|
||
| cp = ts.SpawnWithOpts( | ||
| e2e.OptArgs("update"), | ||
| e2e.OptAppendEnv(suite.env(false, false)...), | ||
| e2e.OptAppendEnv("VERBOSE=true"), | ||
| ) | ||
| cp.ExpectExitCode(0) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This really gives a zero exit code? I would imagine this will fail.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The checker handles some 4xx codes without throwing an error. I think that's what's happening here. |
||
|
|
||
| output := cp.Snapshot() | ||
| suite.Assert().Contains(output, "Getting update info: https://example.com/update/") | ||
| } | ||
|
|
||
| func TestUpdateIntegrationTestSuite(t *testing.T) { | ||
| if testing.Short() { | ||
| t.Skip("skipping integration test in short mode.") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I prefer to use something that's not an actual domain like
test.tld. I can only imagine the traffic example.com sees :pThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
example.com is not a valid domain. This is so you can use it in these contexts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to pretend that I knew that when I wrote this test 🙂