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

lakectl: fixed bug in argument validation #3185

Merged
merged 5 commits into from
Apr 17, 2022

Conversation

johnnyaug
Copy link
Contributor

No description provided.

@johnnyaug johnnyaug added the include-changelog PR description should be included in next release changelog label Apr 10, 2022
@johnnyaug johnnyaug changed the title Fix bug in validate ref lakectl: fixed bug in argument validation Apr 10, 2022
Copy link
Contributor

@arielshaqed arielshaqed left a comment

Choose a reason for hiding this comment

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

Thanks!

AFAICT f7012dd introduced this regression. Can we have a test that will catch the next time we do something like this?

Refs are subtle, and this is a really bad UX.

@nopcoder
Copy link
Contributor

@johnnyaug is it possible to add the test value that will break the previous implementation?

@johnnyaug
Copy link
Contributor Author

@nopcoder done

@johnnyaug johnnyaug requested a review from nopcoder April 14, 2022 11:08
Copy link
Contributor

@nopcoder nopcoder left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@arielshaqed arielshaqed left a comment

Choose a reason for hiding this comment

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

THANKS!

Comment on lines 140 to 155
func TestLakectlBranchAndTagValidation(t *testing.T) {
repoName := generateUniqueRepositoryName()
storage := generateUniqueStorageNamespace(repoName)
validTagName := "my.valid.tag"

vars := map[string]string{
"REPO": repoName,
"STORAGE": storage,
"BRANCH": mainBranch,
"TAG": validTagName,
}
invalidBranchName := "my.invalid.branch"
RunCmdAndVerifySuccessWithFile(t, Lakectl()+" repo create lakefs://"+repoName+" "+storage, false, "lakectl_repo_create", vars)
RunCmdAndVerifyFailureWithFile(t, Lakectl()+" branch create lakefs://"+repoName+"/"+invalidBranchName+" --source lakefs://"+repoName+"/"+mainBranch, false, "lakectl_branch_create_invalid", vars)
RunCmdAndVerifySuccessWithFile(t, Lakectl()+" tag create lakefs://"+repoName+"/"+validTagName+" lakefs://"+repoName+"/"+mainBranch, false, "lakectl_tag_create", vars)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Neat!

Please also test main~3, main~3^2^^, and a few similar ones?

@johnnyaug johnnyaug merged commit 90f52f5 into master Apr 17, 2022
@johnnyaug johnnyaug deleted the bugfix/path_validation_regex branch April 17, 2022 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
include-changelog PR description should be included in next release changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants