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 unit test flake #41192

Merged
merged 3 commits into from
Sep 28, 2022
Merged

Fix unit test flake #41192

merged 3 commits into from
Sep 28, 2022

Conversation

hanxiaop
Copy link
Member

@hanxiaop hanxiaop commented Sep 27, 2022

Please provide a description of this PR:
Fix #41099

@hanxiaop hanxiaop requested a review from a team as a code owner September 27, 2022 10:00
@istio-policy-bot istio-policy-bot added area/test and release release-notes-none Indicates a PR that does not require release notes. labels Sep 27, 2022
@istio-testing istio-testing added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Sep 27, 2022
@@ -46,15 +50,30 @@ func TestProfileList(t *testing.T) {

func TestProfileListByurl(t *testing.T) {
g := gomega.NewWithT(t)
args := []string{"profile", "list", "--dry-run", "--manifests", "https://github.com/istio/istio/releases/download/1.15.0/istio-1.15.0-linux-amd64.tar.gz"}
tempChars := t.TempDir()
defer os.RemoveAll(tempChars)
Copy link
Member

Choose a reason for hiding this comment

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

TempDir does this already

args := []string{"profile", "list", "--dry-run", "--manifests", "https://github.com/istio/istio/releases/download/1.15.0/istio-1.15.0-linux-amd64.tar.gz"}
tempChars := t.TempDir()
defer os.RemoveAll(tempChars)
manifestsPath := filepath.Join(tempChars, "istio", "istio-1.15.0", "manifests")
Copy link
Member

Choose a reason for hiding this comment

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

you can use tgz.Create like TestInstallPackagePath, it makes this whole thing 1 liner

Copy link
Member

Choose a reason for hiding this comment

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

actually now that I think about it, TestInstallPackagePath already covers this entirely.. maybe we just delete this test

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks. I think we can just delete the test.

@howardjohn
Copy link
Member

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/test and release release-notes-none Indicates a PR that does not require release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Network dependency in unit tests
4 participants