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

Refactor existing index path functions to support multiple indexes later on #510

Merged
merged 8 commits into from
Feb 24, 2020

Conversation

chriskim06
Copy link
Member

@chriskim06 chriskim06 commented Feb 22, 2020

Add a name parameter to the index path functions (and behind the X_KREW_ENABLE_MULTI_INDEX variable) to return the path for the specified index, with "default" being implicit. Refactor the existing calls to use an empty string for now that gets ignored when the variable is unset.

The integration tests fail when X_KREW_ENABLE_MULTI_INDEX is set since the other functionality doesn't exist yet.

Related issue: #483

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 22, 2020
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 22, 2020
@codecov-io
Copy link

codecov-io commented Feb 22, 2020

Codecov Report

Merging #510 into master will increase coverage by 0.24%.
The diff coverage is 92.85%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #510      +/-   ##
==========================================
+ Coverage   58.87%   59.12%   +0.24%     
==========================================
  Files          23       23              
  Lines         997     1003       +6     
==========================================
+ Hits          587      593       +6     
  Misses        350      350              
  Partials       60       60
Impacted Files Coverage Δ
internal/environment/environment.go 89.74% <100%> (+1.86%) ⬆️
internal/indexmigration/migration.go 65.21% <100%> (ø) ⬆️
internal/info/info.go 100% <100%> (ø) ⬆️
internal/receiptsmigration/migration.go 46.15% <50%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 18eafeb...4462b8a. Read the comment docs.

Copy link
Contributor

@corneliusweig corneliusweig left a comment

Choose a reason for hiding this comment

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

Overall looks good to me. However, you need to test both behaviors at the same time. I.e. you need to set up the X_KREW_ENABLE_MULTI_INDEX env var in tests, so that you can test both branches.

internal/environment/environment.go Outdated Show resolved Hide resolved
internal/environment/environment_test.go Outdated Show resolved Hide resolved
internal/environment/environment_test.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 22, 2020
internal/indexmigration/migration_test.go Outdated Show resolved Hide resolved
pkg/constants/constants.go Outdated Show resolved Hide resolved
internal/environment/environment.go Show resolved Hide resolved
internal/environment/environment_test.go Outdated Show resolved Hide resolved
internal/environment/environment_test.go Outdated Show resolved Hide resolved
internal/environment/environment_test.go Outdated Show resolved Hide resolved
@ahmetb
Copy link
Member

ahmetb commented Feb 24, 2020

Refactor the existing calls to use an empty string for now that gets ignored when the variable is unset.

In general, if you use "default" string everywhere, you can finish refactoring those pieces later. Whereas "" is harder to find and replace.

cmd/krew/cmd/install.go Outdated Show resolved Hide resolved
@ahmetb
Copy link
Member

ahmetb commented Feb 24, 2020

LGTM but one major point surfaced up in all the patch.

Copy link
Contributor

@corneliusweig corneliusweig left a comment

Choose a reason for hiding this comment

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

Looks good overall. I have only some smaller nits, then let's merge this.

internal/indexmigration/migration.go Outdated Show resolved Hide resolved
internal/environment/environment.go Outdated Show resolved Hide resolved
internal/environment/environment_test.go Outdated Show resolved Hide resolved
internal/environment/environment_test.go Outdated Show resolved Hide resolved
internal/environment/environment.go Outdated Show resolved Hide resolved
@corneliusweig
Copy link
Contributor

Ok, let's get this in. Once the conflict is solved, I'll merge.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 24, 2020
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 24, 2020
@ahmetb
Copy link
Member

ahmetb commented Feb 24, 2020

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 24, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahmetb, chriskim06

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 24, 2020
@k8s-ci-robot k8s-ci-robot merged commit 4f1339f into kubernetes-sigs:master Feb 24, 2020
@chriskim06 chriskim06 deleted the index-paths branch June 11, 2020 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/multi-index cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants