-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Conversation
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 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. |
2427003
to
e4e0636
Compare
/assign @adohe |
@zjj2wry I would review this today, sorry about late response. |
@adohe ok,think you |
}, | ||
} | ||
test := createClusterTest{ | ||
description: "Testing kubectl config set-cluster a exist cluster", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
confused description.
There was a problem hiding this comment.
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"
@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-bot verify test this |
@thockin i rebase lastest master. but the do-not-merge tag always exists. how can i remove it ? think you very much. |
/unassign @dshulyak |
I cleared do-not-merge, but someone has to LGTM who knows this code. |
@k8s-bot pull-kubernetes-unit test this |
@k8s-bot pull-kubernetes-e2e-gce-etcd3 test this |
@k8s-bot verify test this |
@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", |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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()) |
There was a problem hiding this comment.
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]) |
There was a problem hiding this comment.
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])
@zjj2wry just a few minor nits. |
@fabianofranz thank you for review :) |
@zjj2wry thank you! /lgtm |
[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 |
@zjj2wry: The following test(s) failed:
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. |
Automatic merge from submit-queue |
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: