-
Notifications
You must be signed in to change notification settings - Fork 38.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
A couple of e2e fixes #16676
Merged
Merged
A couple of e2e fixes #16676
Changes from all commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -211,10 +211,9 @@ var _ = Describe("Kubectl client", func() { | |
|
||
// Build the static kubectl | ||
By("Finding a static kubectl for upload") | ||
testStaticKubectlPath := path.Join(testContext.RepoRoot, "platforms/linux/386/kubectl") | ||
_, err = os.Stat(testStaticKubectlPath) | ||
testStaticKubectlPath, err := findBinary("kubectl", "linux/386") | ||
if err != nil { | ||
Logf("No kubectl in %s. Attempting a local build...", testStaticKubectlPath) | ||
Logf("No kubectl found: %v.\nAttempting a local build...", err) | ||
// Fall back to trying to build a local static kubectl | ||
kubectlContainerPath := path.Join(testContext.RepoRoot, "/examples/kubectl-container/") | ||
if _, err := os.Stat(path.Join(testContext.RepoRoot, "hack/build-go.sh")); err != nil { | ||
|
@@ -1201,3 +1200,34 @@ func streamingUpload(file *os.File, fileName string, postBodyWriter *multipart.W | |
Failf("Unable to close the writer for file upload. Error: %s", err) | ||
} | ||
} | ||
|
||
var binPrefixes = []string{ | ||
"_output/dockerized/bin", | ||
"_output/local/bin", | ||
"platforms", | ||
} | ||
|
||
// findBinary searches through likely paths to find the specified binary. It | ||
// takes the one that has been built most recently. Platform should be | ||
// specified as '<os>/<arch>'. For example: 'linux/amd64'. | ||
func findBinary(binName string, platform string) (string, error) { | ||
var binTime time.Time | ||
var binPath string | ||
|
||
for _, pre := range binPrefixes { | ||
tryPath := path.Join(testContext.RepoRoot, pre, platform, binName) | ||
fi, err := os.Stat(tryPath) | ||
if err != nil { | ||
continue | ||
} | ||
if fi.ModTime().After(binTime) { | ||
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. nit: It would be nice to log if a version was chosen because of a later build. I could see some confusion as to why one binary was chosen over another until reading the code. |
||
binPath = tryPath | ||
binTime = fi.ModTime() | ||
} | ||
} | ||
|
||
if len(binPath) > 0 { | ||
return binPath, nil | ||
} | ||
return binPath, fmt.Errorf("Could not find %v for %v", binName, platform) | ||
} |
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
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.
@ashcrow @ncdc