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

query_test.go added - TestValidate method defined #2298

Merged
merged 1 commit into from
Jan 27, 2021

Conversation

ghost
Copy link

@ghost ghost commented Jan 20, 2021

Related to #2297



$ go test -v query_test.go create.go  kepctl.go  promote.go query.go  

=== RUN   TestValidate
=== RUN   TestValidate/Valid_SIG
=== RUN   TestValidate/Invalid_SIG
=== RUN   TestValidate/Unsupported_Output_format
--- PASS: TestValidate (0.00s)
    --- PASS: TestValidate/Valid_SIG (0.00s)
    --- PASS: TestValidate/Invalid_SIG (0.00s)
    --- PASS: TestValidate/Unsupported_Output_format (0.00s)
PASS
ok  	command-line-arguments	2.798s

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 20, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @shekhar-rajak. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 20, 2021
@ghost
Copy link
Author

ghost commented Jan 20, 2021

Please let me know, if I need to squash the commits.

@kikisdeliveryservice
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 20, 2021
@kikisdeliveryservice
Copy link
Member

kikisdeliveryservice commented Jan 20, 2021

Please let me know, if I need to squash the commits.

I would squash the commits :)

Pinging @jeremyrickard @palnabarun since they're working on this - also I don't see a kepval/kepctl label for these types of prs? should we add.

@@ -0,0 +1,89 @@
/*
Copyright 2020 The Kubernetes Authors.
Copy link
Member

Choose a reason for hiding this comment

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

oo, 2021

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the review. I think we need to change this line every file, where we have Copyright 2020 written

Copy link
Member

Choose a reason for hiding this comment

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

Copyright headers of all files need not be changed. IIRC, whenever we create a new file, we use the year of creation.

Copy link
Member

Choose a reason for hiding this comment

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

@palnabarun is correct, just when a new file is created.

@ghost ghost force-pushed the query_test branch from 3dea612 to 53e87ff Compare January 21, 2021 13:44
@ghost
Copy link
Author

ghost commented Jan 21, 2021

I have squashed the commits. Please review.

@ghost
Copy link
Author

ghost commented Jan 21, 2021

Once this is merged I can add more testcases as part of #2282

@palnabarun
Copy link
Member

/sig release
/sig architecture
/area enhancements

@k8s-ci-robot k8s-ci-robot added sig/release Categorizes an issue or PR as relevant to SIG Release. sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. area/enhancements Issues or PRs related to the Enhancements subproject labels Jan 25, 2021
@palnabarun
Copy link
Member

/cc

Copy link
Member

@kikisdeliveryservice kikisdeliveryservice left a comment

Choose a reason for hiding this comment

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

Also q for line 69 comment: "// check if the Output specified is one of "", "json" or "yaml""

It seems stale? Shouldnt that be table json yaml? If so could you update since we're in the file anyway? :)

@@ -54,7 +54,7 @@ type QueryOpts struct {
}

// Validate checks the args and cleans them up if needed

Choose a reason for hiding this comment

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

Q (since you're in this file already 😄 ): is this comment^^ correct?

I don't really see the func cleaning them up?

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, we can see function is not using the args now. Removing this comment. Thanks for the review.

@ghost ghost force-pushed the query_test branch from 53e87ff to 6cbbc42 Compare January 26, 2021 09:59
@ghost
Copy link
Author

ghost commented Jan 27, 2021

I think, now it is good to test and review. Once this PR is merged, I will work on #2282 test cases

Copy link
Member

@justaugustus justaugustus left a comment

Choose a reason for hiding this comment

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

@shekhar-rajak -- Just two nits here.

Comment on lines 17 to 21
/*

TO run the test case: go test -v query_test.go create.go kepctl.go promote.go query.go

*/
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/*
TO run the test case: go test -v query_test.go create.go kepctl.go promote.go query.go
*/

You can drop this note.

Copy link
Author

Choose a reason for hiding this comment

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

Done

"fmt"
"testing"

"github.com/stretchr/testify/assert"
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

Done

Validate funtion: removed unused arguments

minor change: Copyright 2020 to Copyright 2021

Unnecessary comment is removed

Using require instead of assert in test file
@ghost ghost force-pushed the query_test branch from 6cbbc42 to 1e22f0b Compare January 27, 2021 18:04
@ghost
Copy link
Author

ghost commented Jan 27, 2021

Thanks @justaugustus, for the review. I have updated the commit. I think now it is good to go.

@justaugustus
Copy link
Member

Thanks!
/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 Jan 27, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: justaugustus, shekhar-rajak

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 Jan 27, 2021
@k8s-ci-robot k8s-ci-robot merged commit 8cac891 into kubernetes:master Jan 27, 2021
@k8s-ci-robot k8s-ci-robot added this to the v1.21 milestone Jan 27, 2021
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/enhancements Issues or PRs related to the Enhancements subproject 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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. sig/release Categorizes an issue or PR as relevant to SIG Release. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants