Skip to content

Commit

Permalink
Update tests to follow convention; increase processing time
Browse files Browse the repository at this point in the history
  • Loading branch information
dlmiddlecote committed Jul 14, 2019
1 parent 18a1243 commit 2aa7e7b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions examples/11-filtering-handlers/test_example_11.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,19 @@

@pytest.fixture(autouse=True)
def crd_exists():
subprocess.run(f"kubectl apply -f {crd_yaml}", shell=True, check=True)
subprocess.run(f"kubectl apply -f {crd_yaml}",
check=True, timeout=10, capture_output=True, shell=True)


@pytest.fixture(autouse=True)
def obj_absent():
subprocess.run(f"kubectl delete -f {obj_yaml}", shell=True, check=False)
# Operator is not running in fixtures, so we need a force-delete (or this patch).
subprocess.run(['kubectl', 'patch', '-f', obj_yaml,
'-p', '{"metadata":{"finalizers":[]}}',
'--type', 'merge'],
check=False, timeout=10, capture_output=True)
subprocess.run(f"kubectl delete -f {obj_yaml}",
check=False, timeout=10, capture_output=True, shell=True)


def test_handler_filtering(mocker):
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_all_examples_are_runnable(mocker, with_crd, with_peering, exampledir):
# Run an operator and simulate some activity with the operated resource.
with KopfRunner(['run', '--verbose', str(example_py)]) as runner:
subprocess.run("kubectl apply -f examples/obj.yaml", shell=True, check=True)
time.sleep(e2e_create_time or 1) # give it some time to react and to sleep and to retry
time.sleep(e2e_create_time or 2) # give it some time to react and to sleep and to retry
subprocess.run("kubectl delete -f examples/obj.yaml", shell=True, check=True)
time.sleep(e2e_delete_time or 1) # give it some time to react

Expand Down

0 comments on commit 2aa7e7b

Please sign in to comment.