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

unit test for kubectl config set-cluster #43505

Merged
merged 1 commit into from
Jun 1, 2017

Conversation

zjj2wry
Copy link
Contributor

@zjj2wry zjj2wry commented Mar 22, 2017

What this PR does / why we need it:
unit test for create cluster

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #

Special notes for your reviewer:
i want test secure mode,but CA path how set?

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 22, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@k8s-ci-robot
Copy link
Contributor

Hi @zjj2wry. 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 @k8s-bot 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.

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. I understand the commands that are listed here.

@k8s-github-robot k8s-github-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. release-note-label-needed labels Mar 22, 2017
@zjj2wry zjj2wry changed the title create cluster unit test for create cluster Mar 22, 2017
@zjj2wry zjj2wry changed the title unit test for create cluster unit test for kubectl config set-cluster Mar 22, 2017
@zjj2wry
Copy link
Contributor Author

zjj2wry commented Mar 22, 2017

@adohe

@zjj2wry zjj2wry force-pushed the 004 branch 2 times, most recently from 2427003 to e4e0636 Compare March 25, 2017 11:00
@k8s-github-robot k8s-github-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 25, 2017
@k8s-github-robot k8s-github-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 25, 2017
@adohe-zz
Copy link

/assign @adohe

@adohe-zz
Copy link

@zjj2wry I would review this today, sorry about late response.

@zjj2wry
Copy link
Contributor Author

zjj2wry commented Mar 30, 2017

@adohe ok,think you

@grodrigues3 grodrigues3 added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 5, 2017
@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 7, 2017
},
}
test := createClusterTest{
description: "Testing kubectl config set-cluster a exist cluster",

Choose a reason for hiding this comment

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

confused description.

Copy link
Contributor

Choose a reason for hiding this comment

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

Make it "Testing 'kubectl config set-cluster' with an existing cluster"

@adohe-zz
Copy link

@zjj2wry I am sorry about the late, I was just too busy recently. This generally lgtm. Could you please rebase this? Then I will apply the label.

@k8s-github-robot k8s-github-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 19, 2017
@k8s-github-robot k8s-github-robot removed the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Apr 19, 2017
@zjj2wry
Copy link
Contributor Author

zjj2wry commented May 17, 2017

@k8s-bot verify test this

@zjj2wry
Copy link
Contributor Author

zjj2wry commented May 23, 2017

@thockin i rebase lastest master. but the do-not-merge tag always exists. how can i remove it ? think you very much.

@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 23, 2017
@zjj2wry
Copy link
Contributor Author

zjj2wry commented May 23, 2017

/unassign @dshulyak

@thockin thockin removed the do-not-merge DEPRECATED. Indicates that a PR should not merge. Label can only be manually applied/removed. label May 23, 2017
@thockin
Copy link
Member

thockin commented May 23, 2017

I cleared do-not-merge, but someone has to LGTM who knows this code.

@zjj2wry
Copy link
Contributor Author

zjj2wry commented May 23, 2017

@k8s-bot pull-kubernetes-unit test this

@zjj2wry
Copy link
Contributor Author

zjj2wry commented May 24, 2017

@k8s-bot pull-kubernetes-e2e-gce-etcd3 test this

@zjj2wry
Copy link
Contributor Author

zjj2wry commented May 24, 2017

@k8s-bot verify test this

@zjj2wry
Copy link
Contributor Author

zjj2wry commented May 27, 2017

@fabianofranz sorry about ping you often. can you help me review this.the assign reviewer maybe not online recent. think you ~

func TestCreateCluster(t *testing.T) {
conf := clientcmdapi.Config{}
test := createClusterTest{
description: "Testing kubectl config set-cluster a cluster",
Copy link
Contributor

Choose a reason for hiding this comment

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

Make it "Testing 'kubectl config set-cluster' with a new cluster"

cmd.SetArgs(test.args)
cmd.Flags().Parse(test.flags)
if err := cmd.Execute(); err != nil {
t.Fatalf("unexpected error executing command: %v,kubectl set-cluster args:%v,flags:%v", err, test.args, test.flags)
Copy link
Contributor

Choose a reason for hiding this comment

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

t.Fatalf("unexpected error executing command: %v, args: %v, flags: %v", err, test.args, test.flags)

}
if len(test.expected) != 0 {
if buf.String() != test.expected {
t.Errorf("Failded in %q\n expected %v\n but got %v", test.description, test.expected, buf.String())
Copy link
Contributor

Choose a reason for hiding this comment

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

"Failed ..."

if len(test.args) > 0 {
cluster, ok := config.Clusters[test.args[0]]
if !ok {
t.Errorf("expected create cluster %v, but got nil", test.args[0])
Copy link
Contributor

Choose a reason for hiding this comment

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

t.Errorf("expected cluster %v, got nil", test.args[0])

@fabianofranz
Copy link
Contributor

@zjj2wry just a few minor nits.

@zjj2wry
Copy link
Contributor Author

zjj2wry commented May 31, 2017

@fabianofranz thank you for review :)

@fabianofranz
Copy link
Contributor

@zjj2wry thank you!

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 31, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adohe, fabianofranz, zjj2wry

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

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Jun 1, 2017

@zjj2wry: The following test(s) failed:

Test name Commit Details Rerun command
Jenkins verification 988aadb link @k8s-bot verify test this

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@zjj2wry
Copy link
Contributor Author

zjj2wry commented Jun 1, 2017

@k8s-bot pull-kubernetes-node-e2e test this
@k8s-bot pull-kubernetes-kubemark-e2e-gce test this
@k8s-bot pull-kubernetes-e2e-kops-aws test this
@k8s-bot pull-kubernetes-federation-e2e-gce test this
@k8s-bot pull-kubernetes-e2e-gce-etcd3 test this

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 2269f5c into kubernetes:master Jun 1, 2017
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. 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. release-note-none Denotes a PR that doesn't merit a release note. 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.

9 participants