Skip to content

Commit 91bd6de

Browse files
authored
Change show kube command default value of insecure key to True (sonic-net#2517)
* Change show kube command default value of insecure key to True Signed-off-by: Yun Li <[email protected]> * Add test cases Signed-off-by: Yun Li <[email protected]>
1 parent c44c584 commit 91bd6de

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

show/kube.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def config(db):
4545
# (<header name>, <field name>, <default val>)
4646
("ip", "ip" "", False),
4747
("port", "port", "6443"),
48-
("insecure", "insecure", "False"),
48+
("insecure", "insecure", "True"),
4949
("disable","disable", "False")
5050
]
5151

tests/kube_test.py

+26
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,18 @@
3434
10.3.157.24 7777 True False
3535
"""
3636

37+
show_server_output_5="""\
38+
ip port insecure disable
39+
----------- ------ ---------- ---------
40+
10.10.10.11 6443 True False
41+
"""
42+
43+
show_server_output_6="""\
44+
ip port insecure disable
45+
----------- ------ ---------- ---------
46+
10.3.157.24 6443 True False
47+
"""
48+
3749
empty_server_status="""\
3850
Kubernetes server has no status info
3951
"""
@@ -96,6 +108,20 @@ def test_no_kube_server(self, get_cmd_module):
96108
result = runner.invoke(config.config.commands["kubernetes"].commands["server"], ["ip", "10.10.10.11"], obj=db)
97109
self.__check_res(result, "set server IP when none", "")
98110

111+
result = runner.invoke(show.cli.commands["kubernetes"].commands["server"].commands["config"], [], obj=db)
112+
self.__check_res(result, "config command default value", show_server_output_5)
113+
114+
115+
def test_only_kube_server(self, get_cmd_module):
116+
(config, show) = get_cmd_module
117+
runner = CliRunner()
118+
db = Db()
119+
120+
db.cfgdb.delete_table("KUBERNETES_MASTER")
121+
db.cfgdb.set_entry("KUBERNETES_MASTER", "SERVER", {"ip": "10.3.157.24"})
122+
123+
result = runner.invoke(show.cli.commands["kubernetes"].commands["server"].commands["config"], [], obj=db)
124+
self.__check_res(result, "show command default value", show_server_output_6)
99125

100126

101127
def test_kube_server_status(self, get_cmd_module):

0 commit comments

Comments
 (0)