mirror of
https://github.com/kubescape/kubescape.git
synced 2026-02-14 09:59:54 +00:00
support input from file
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import sys
|
||||
import smoke_utils
|
||||
|
||||
|
||||
tests_pkg = [
|
||||
"test_command"
|
||||
@@ -5,11 +8,11 @@ tests_pkg = [
|
||||
]
|
||||
|
||||
|
||||
def run():
|
||||
def run(**kwargs):
|
||||
for i in tests_pkg:
|
||||
m = __import__(i)
|
||||
m.run()
|
||||
m.run(**kwargs)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run()
|
||||
run(kubescape_exec=smoke_utils.get_exec_from_args(sys.argv))
|
||||
|
||||
@@ -28,3 +28,7 @@ def check_status(status, msg):
|
||||
stderr.write(msg)
|
||||
exit(status)
|
||||
|
||||
|
||||
def get_exec_from_args(args: list):
|
||||
return args[1]
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import subprocess
|
||||
import smoke_utils
|
||||
import sys
|
||||
|
||||
|
||||
def test_command(command: list):
|
||||
@@ -12,20 +13,19 @@ def test_command(command: list):
|
||||
print(f"Done testing \"{' '.join(command[1:])}\" command")
|
||||
|
||||
|
||||
def run():
|
||||
def run(kubescape_exec:str):
|
||||
print("Testing supported commands")
|
||||
|
||||
bin_cli = smoke_utils.get_bin_cli()
|
||||
test_command(command=[bin_cli, "version"])
|
||||
test_command(command=[bin_cli, "download"])
|
||||
test_command(command=[bin_cli, "config"])
|
||||
test_command(command=[bin_cli, "help"])
|
||||
test_command(command=[bin_cli, "scan"])
|
||||
test_command(command=[bin_cli, "scan", "framework"])
|
||||
test_command(command=[bin_cli, "scan", "control"])
|
||||
test_command(command=[kubescape_exec, "version"])
|
||||
test_command(command=[kubescape_exec, "download"])
|
||||
test_command(command=[kubescape_exec, "config"])
|
||||
test_command(command=[kubescape_exec, "help"])
|
||||
test_command(command=[kubescape_exec, "scan"])
|
||||
test_command(command=[kubescape_exec, "scan", "framework"])
|
||||
test_command(command=[kubescape_exec, "scan", "control"])
|
||||
|
||||
print("Done testing commands")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run()
|
||||
run(kubescape_exec=smoke_utils.get_exec_from_args(sys.argv))
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
import os
|
||||
import subprocess
|
||||
import smoke_utils
|
||||
import sys
|
||||
|
||||
|
||||
def run():
|
||||
def run(kubescape_exec:str):
|
||||
print("Testing version")
|
||||
|
||||
ver = os.getenv("RELEASE")
|
||||
msg = str(subprocess.check_output([smoke_utils.get_bin_cli(), "version"]))
|
||||
msg = str(subprocess.check_output([kubescape_exec, "version"]))
|
||||
assert ver in msg, f"expected version: {ver}, found: {msg}"
|
||||
|
||||
print("Done testing version")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run()
|
||||
run(kubescape_exec=smoke_utils.get_exec_from_args(sys.argv))
|
||||
|
||||
Reference in New Issue
Block a user