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

cleanup: Do not use path calculation in multi-index integration tests #562

Closed
ahmetb opened this issue Mar 28, 2020 · 4 comments · Fixed by #627
Closed

cleanup: Do not use path calculation in multi-index integration tests #562

ahmetb opened this issue Mar 28, 2020 · 4 comments · Fixed by #627
Labels
area/multi-index kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.

Comments

@ahmetb
Copy link
Member

ahmetb commented Mar 28, 2020

Right now the integration tests for TestKrewIndex** methods have:

localIndex := test.TempDir().Path("index/" + constants.DefaultIndexName)

We should avoid guessing directory layouts in the test code, and in general.

environment.Paths type is supposed to calculate path segments.

It's advisable to move these to use:

localIndex := environment.NewPaths(test.Root()).IndexPath(constants.DefaultIndexName)

after the multi-index switch can be removed. Otherwise these tests will also need os.Setenv + "defer os.Unsetenv" with constants.EnableMultiIndexSwitch to influence how environment.Paths computes paths.

cc: @chriskim06
/kind cleanup
/priority important-soon
/area multi-index

@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. area/multi-index labels Mar 28, 2020
@chriskim06
Copy link
Member

Should we switch these to use environment.Paths/Setenv and Unsetenv now? There's the item in #566 to remove the multi-index flag feature where the Setenv and Unsetenv could be cleaned up in the tests along with the os.Getenv(...) calls in the code.

@ahmetb
Copy link
Member Author

ahmetb commented Apr 30, 2020

Since it's tied to that this is probably one of the last items to do. But take it for a spin if you're sure we can churn through the list rather quickly.

@ahmetb
Copy link
Member Author

ahmetb commented Jul 27, 2020

@chriskim06 any ideas if this is addressed?

@chriskim06
Copy link
Member

I haven''t started this yet, but should be able to get to it fairly soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/multi-index kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants