Skip to content

Commit

Permalink
Change show kube command default value of insecure key to True (#2517)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
lixiaoyuner authored and yxieca committed Dec 1, 2022
1 parent 0a030ce commit f2bf7ed
Show file tree
Hide file tree
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
Expand Up @@ -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")
]

Expand Down
26 changes: 26 additions & 0 deletions tests/kube_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit f2bf7ed

Please sign in to comment.