-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
OCPBUGS-18534: monitor test fix to wait before connecting to a non-existent dns on PowerVS and IBMCloud platforms #28739
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -179,6 +179,32 @@ func NewCLIWithoutNamespace(project string) *CLI { | |
return cli | ||
} | ||
|
||
// NewCLIForMonitorTest initializes the CLI and Kube framework helpers | ||
// without a namespace. Should be called outside of a Ginkgo .It() | ||
// function. | ||
func NewCLIForMonitorTest(project string) *CLI { | ||
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. So you needed new non ginko versions of this and Run to support running in the monitor test environment? Thanks for setting those up. 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. Correct |
||
cli := &CLI{ | ||
kubeFramework: &framework.Framework{ | ||
SkipNamespaceCreation: true, | ||
BaseName: project, | ||
Options: framework.Options{ | ||
ClientQPS: 20, | ||
ClientBurst: 50, | ||
}, | ||
Timeouts: framework.NewTimeoutContext(), | ||
}, | ||
username: "admin", | ||
execPath: "oc", | ||
adminConfigPath: KubeConfigPath(), | ||
staticConfigManifestDir: StaticConfigManifestDir(), | ||
withoutNamespace: true, | ||
} | ||
|
||
// Called only once (assumed the objects will never get modified) | ||
cli.setupStaticConfigsFromManifests() | ||
return cli | ||
} | ||
|
||
// NewHypershiftManagementCLI returns a CLI that interacts with the Hypershift management cluster. | ||
// Contrary to a normal CLI it does not perform any cleanup, and it must not be used for any mutating | ||
// operations. Also, contrary to a normal CLI it must be constructed inside an `It` block. This is | ||
|
@@ -813,6 +839,22 @@ func (c *CLI) Run(commands ...string) *CLI { | |
return nc.setOutput(c.stdout) | ||
} | ||
|
||
// Executes with the kubeconfig specified from the environment | ||
func (c *CLI) RunInMonitorTest(commands ...string) *CLI { | ||
in, out, errout := &bytes.Buffer{}, &bytes.Buffer{}, &bytes.Buffer{} | ||
nc := &CLI{ | ||
execPath: c.execPath, | ||
verb: commands[0], | ||
kubeFramework: c.KubeFramework(), | ||
adminConfigPath: c.adminConfigPath, | ||
configPath: c.configPath, | ||
username: c.username, | ||
globalArgs: commands, | ||
} | ||
nc.stdin, nc.stdout, nc.stderr = in, out, errout | ||
return nc.setOutput(c.stdout) | ||
} | ||
|
||
// InputString adds expected input to the command | ||
func (c *CLI) InputString(input string) *CLI { | ||
c.stdin.WriteString(input) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Not trying to be difficult. Looks like Poll is deprecated. Also I think if you pass in the context from the StartCollection call and use it in PollUntilContextTimeout you won't block if that ctx gets canceled and you can set an explicit max time for your checkHostnameReady function to block for. I haven't tried it but the patch is attached if you want to.
origin_PollUntilContextTimeout.patch.txt
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.
Sure - we can look at it