Differentiate update/create message on set-context

kubectl config set-context prints the same message (Context %q set) for both
new and existing contexts. This patch helps differentiate whether an existing
context is modified or a new context is created.

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This commit is contained in:
Ahmet Alp Balkan
2017-05-12 16:57:33 -07:00
parent 7a9c2f7f01
commit f39afd4eeb
2 changed files with 14 additions and 9 deletions

View File

@@ -46,7 +46,7 @@ func TestCreateContext(t *testing.T) {
"--user=user_nickname",
"--namespace=namespace",
},
expected: `Context "shaker-context" set.` + "\n",
expected: `Context "shaker-context" created.` + "\n",
expectedConfig: clientcmdapi.Config{
Contexts: map[string]*clientcmdapi.Context{
"shaker-context": {AuthInfo: "user_nickname", Cluster: "cluster_nickname", Namespace: "namespace"}},
@@ -68,7 +68,7 @@ func TestModifyContext(t *testing.T) {
"--user=user_nickname",
"--namespace=namespace",
},
expected: `Context "shaker-context" set.` + "\n",
expected: `Context "shaker-context" modified.` + "\n",
expectedConfig: clientcmdapi.Config{
Contexts: map[string]*clientcmdapi.Context{
"shaker-context": {AuthInfo: "user_nickname", Cluster: "cluster_nickname", Namespace: "namespace"},