mirror of
https://github.com/kubescape/kubescape.git
synced 2026-02-14 18:09:55 +00:00
support input from file
This commit is contained in:
2
.github/workflows/build.yaml
vendored
2
.github/workflows/build.yaml
vendored
@@ -50,7 +50,7 @@ jobs:
|
||||
env:
|
||||
RELEASE: v1.0.${{ github.run_number }}
|
||||
KUBESCAPE_SKIP_UPDATE_CHECK: "true"
|
||||
run: python3 smoke_testing/init.py
|
||||
run: python3 smoke_testing/init.py ${PWD}/build/${{ matrix.os }}/kubescape
|
||||
|
||||
- name: Upload Release binaries
|
||||
id: upload-release-asset
|
||||
|
||||
2
.github/workflows/build_dev.yaml
vendored
2
.github/workflows/build_dev.yaml
vendored
@@ -34,7 +34,7 @@ jobs:
|
||||
env:
|
||||
RELEASE: v1.0.${{ github.run_number }}
|
||||
KUBESCAPE_SKIP_UPDATE_CHECK: "true"
|
||||
run: python3 smoke_testing/init.py
|
||||
run: python3 smoke_testing/init.py ${PWD}/build/${{ matrix.os }}/kubescape
|
||||
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,4 +2,5 @@
|
||||
*kubescape*
|
||||
*debug*
|
||||
*vender*
|
||||
*.pyc*
|
||||
.idea
|
||||
@@ -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