Skip to content

Commit

Permalink
chore: fix helm default RBAC
Browse files Browse the repository at this point in the history
  • Loading branch information
machine424 committed Sep 13, 2023
1 parent 8bddc0d commit 7876217
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions tests/e2e_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

TESTS_PATH = Path(__file__).parent
MANIFESTS_PATH = TESTS_PATH / "manifests"
TEST_NS = "test-ns"

TIMEOUT = SYNC_INTERVAL * 3

Expand All @@ -26,6 +27,7 @@ def run(*, command: list[str], **kw_args) -> str:
@pytest.fixture(scope="session")
def setup():
try:
run(command=["kubectl", "create", "namespace", TEST_NS])
run(
command=[
"helm",
Expand Down Expand Up @@ -57,7 +59,7 @@ def setup():
]
)

run(command=["kubectl", "apply", "-f", f"{MANIFESTS_PATH}/metrics-generator.yaml"])
run(command=["kubectl", "apply", "-f", f"{MANIFESTS_PATH}/metrics-generator.yaml", "--namespace", TEST_NS])
yield
finally:
run(
Expand All @@ -74,19 +76,21 @@ def setup():
"prometheus-adapter",
]
)
run(command=["kubectl", "delete", "-f", f"{MANIFESTS_PATH}/metrics-generator.yaml"])
run(command=["kubectl", "delete", "-f", f"{MANIFESTS_PATH}/metrics-generator.yaml", "--namespace", TEST_NS])
run(command=["kubectl", "delete", "namespace", TEST_NS])


def deploy_target(manifest: str):
run(command=["kubectl", "apply", "-f", f"{MANIFESTS_PATH}/{manifest}"])
run(command=["kubectl", "apply", "-f", f"{MANIFESTS_PATH}/{manifest}", "--namespace", TEST_NS])


def delete_target(manifest: str):
run(command=["kubectl", "delete", "-f", f"{MANIFESTS_PATH}/{manifest}"])
run(command=["kubectl", "delete", "-f", f"{MANIFESTS_PATH}/{manifest}", "--namespace", TEST_NS])


def run_scaler():
return subprocess.Popen(["python", f"{TESTS_PATH.parent}/main.py"])
# return subprocess.Popen(["python", f"{TESTS_PATH.parent}/main.py", "--hpa-namespace", TEST_NS])
return subprocess.Popen(["python", f"{TESTS_PATH.parent}/main.py", "--hpa-namespace", TEST_NS])


def set_foo_metric_value(value: int):
Expand All @@ -111,6 +115,8 @@ def wait_deployment_scale(*, name: str, replicas: int):
f"--for=jsonpath={{.spec.replicas}}={replicas}",
"deployment",
name,
"--namespace",
TEST_NS,
f"--timeout={TIMEOUT}s",
]
)
Expand Down

0 comments on commit 7876217

Please sign in to comment.