Skip to content

Commit

Permalink
Undo shorter times
Browse files Browse the repository at this point in the history
  • Loading branch information
ekampf committed Mar 12, 2024
1 parent 531ffae commit 536f496
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions tests_integration/test_connector_flows.py
Expand Up @@ -27,7 +27,7 @@ def inner():
"CONNECTOR_RECONCILER_INIT_DELAY": "1",
},
) as runner:
time.sleep(2)
time.sleep(5)
yield

assert runner.exception is None
Expand Down Expand Up @@ -83,15 +83,15 @@ def test_connector_flows(run_kopf, ci_run_number):

# Check that if pod is deleted we recreate it
kubectl_delete(f"pod/{connector_name}")
time.sleep(5)
time.sleep(10)
pod = kubectl_get("pod", connector_name)

assert pod["status"]["phase"] == "Running"
assert pod["metadata"]["ownerReferences"][0]["name"] == connector_name
assert pod["metadata"]["ownerReferences"][0]["kind"] == "TwingateConnector"

kubectl_delete(f"tc/{connector_name}")
time.sleep(5)
time.sleep(10)

# secret & pod are deleted
with pytest.raises(CalledProcessError):
Expand Down Expand Up @@ -141,13 +141,13 @@ def test_connector_flows_image_change(run_kopf, ci_run_number):
# Change image tag
# kubectl patch tc/test-connector-image-local -p '{"spec": {"image": {"tag": "1.63.0"}}}' --type=merge
kubectl_patch(f"tc/{connector_name}", {"spec": {"image": {"tag": "1.63.0"}}})
time.sleep(5)
time.sleep(10)
pod = kubectl_get("pod", connector_name)
assert pod["status"]["phase"] == "Running"
assert pod["spec"]["containers"][0]["image"] == "twingate/connector:1.63.0"

kubectl_delete(f"tc/{connector_name}")
time.sleep(5)
time.sleep(10)

# secret & pod are deleted
with pytest.raises(CalledProcessError):
Expand Down Expand Up @@ -178,10 +178,7 @@ def test_connector_flows_pod_gone_while_operator_down(run_kopf, ci_run_number):
connector = kubectl_get("tc", connector_name)
kubectl_get("secret", connector_name)
pod = kubectl_get("pod", connector_name)

while pod["status"]["phase"] == "Pending":
time.sleep(1)
pod = kubectl_get("pod", connector_name)
assert pod["status"]["phase"] in ("Running", "Pending")

# connector was properly provisioned
expected_status = {"success": True, "ts": ANY, "twingate_id": ANY}
Expand Down Expand Up @@ -223,6 +220,7 @@ def test_connector_flows_pod_migration_from_older_pod_with_finalizers(
connector = kubectl_get("tc", connector_name)
kubectl_get("secret", connector_name)
pod = kubectl_get("pod", connector_name)
assert pod["status"]["phase"] in ("Running", "Pending")

while pod["status"]["phase"] == "Pending":
time.sleep(1)
Expand All @@ -246,17 +244,12 @@ def test_connector_flows_pod_migration_from_older_pod_with_finalizers(
)

# wait for timer to run
time.sleep(5)
time.sleep(10)

# check pod was recreated
pod = kubectl_get("pod", connector_name)
if pod["status"]["phase"] == "Pending":
time.sleep(5)
pod = kubectl_get("pod", connector_name)

assert pod["status"]["phase"] in ("Running", "Pending")
assert pod["metadata"]["annotations"]["twingate.com/connector-podspec-version"] == "v1" # fmt: skip
# assert pod["status"]["phase"] in ["Running", "Pending"]
assert pod["status"]["phase"] == "Running"

# Test done, delete connector
kubectl_delete(f"tc/{connector_name}")
Expand Down

0 comments on commit 536f496

Please sign in to comment.