Skip to content

Commit

Permalink
Change show kube command default value of insecure key to True (sonic…
Browse files Browse the repository at this point in the history
…-net#2517)

* Change show kube command default value of insecure key to True

Signed-off-by: Yun Li <yunli1@microsoft.com>

* Add test cases

Signed-off-by: Yun Li <yunli1@microsoft.com>
lixiaoyuner authored and preetham-singh committed Dec 6, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 7137509 commit 72ab1a3
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion show/kube.py
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ def config(db):
# (<header name>, <field name>, <default val>)
("ip", "ip" "", False),
("port", "port", "6443"),
("insecure", "insecure", "False"),
("insecure", "insecure", "True"),
("disable","disable", "False")
]

26 changes: 26 additions & 0 deletions tests/kube_test.py
Original file line number Diff line number Diff line change
@@ -34,6 +34,18 @@
10.3.157.24 7777 True False
"""

show_server_output_5="""\
ip port insecure disable
----------- ------ ---------- ---------
10.10.10.11 6443 True False
"""

show_server_output_6="""\
ip port insecure disable
----------- ------ ---------- ---------
10.3.157.24 6443 True False
"""

empty_server_status="""\
Kubernetes server has no status info
"""
@@ -96,6 +108,20 @@ def test_no_kube_server(self, get_cmd_module):
result = runner.invoke(config.config.commands["kubernetes"].commands["server"], ["ip", "10.10.10.11"], obj=db)
self.__check_res(result, "set server IP when none", "")

result = runner.invoke(show.cli.commands["kubernetes"].commands["server"].commands["config"], [], obj=db)
self.__check_res(result, "config command default value", show_server_output_5)


def test_only_kube_server(self, get_cmd_module):
(config, show) = get_cmd_module
runner = CliRunner()
db = Db()

db.cfgdb.delete_table("KUBERNETES_MASTER")
db.cfgdb.set_entry("KUBERNETES_MASTER", "SERVER", {"ip": "10.3.157.24"})

result = runner.invoke(show.cli.commands["kubernetes"].commands["server"].commands["config"], [], obj=db)
self.__check_res(result, "show command default value", show_server_output_6)


def test_kube_server_status(self, get_cmd_module):

0 comments on commit 72ab1a3

Please sign in to comment.