Skip to content

Commit

Permalink
fix retries in tests (#4801)
Browse files Browse the repository at this point in the history
  • Loading branch information
vepatel authored Dec 14, 2023
1 parent 4670aca commit e88a4f2
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion tests/suite/test_transport_server_external_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def test_template_config(
ts_externalname_setup.ic_pod_name,
ingress_controller_prerequisites.namespace,
)
retry = +1
retry = retry + 1

assert resolver_count == 2 # one for http and other for stream context
assert (
Expand Down
4 changes: 2 additions & 2 deletions tests/suite/test_transport_server_service_insight.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def test_ts_service_insight(
while (resp.json() != {"Total": 1, "Up": 1, "Unhealthy": 0}) and retry < 5:
resp = requests.get(service_insight_endpoint)
wait_before_test()
retry = +1
retry = retry + 1
assert resp.json() == {"Total": 1, "Up": 1, "Unhealthy": 0}


Expand Down Expand Up @@ -199,5 +199,5 @@ def test_ts_service_insight_https(
while (resp.json() != {"Total": 1, "Up": 1, "Unhealthy": 0}) and retry < 5:
resp = requests.get(service_insight_endpoint, verify=False)
wait_before_test()
retry = +1
retry = retry + 1
assert resp.json() == {"Total": 1, "Up": 1, "Unhealthy": 0}
2 changes: 1 addition & 1 deletion tests/suite/test_virtual_server_backup_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def get_result_in_conf_with_retry(
ic_pod_name,
ic_pod_namespace,
)
retry = +1
retry = retry + 1
return result_conf


Expand Down
2 changes: 1 addition & 1 deletion tests/suite/test_virtual_server_error_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_redirect_strategy(self, kube_apis, crd_ingress_controller, virtual_serv
print(f"redirect to uri: {resp.next.url}")
except AttributeError as e:
print(f"Exception occurred: {e}")
retry = +1
retry = retry + 1
continue
break
assert f"http://{virtual_server_setup.vs_host}/error.html" in resp.next.url
Expand Down
6 changes: 3 additions & 3 deletions tests/suite/test_virtual_server_service_insight.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_responses_svc_insight_http(
while (resp.json() != {"Total": 3, "Up": 3, "Unhealthy": 0}) and retry < 5:
resp = requests.get(req_url)
wait_before_test()
retry = +1
retry = retry + 1

assert resp.status_code == 200, f"Expected 200 code for /probe/{host} but got {resp.status_code}"
assert resp.json() == {"Total": 3, "Up": 3, "Unhealthy": 0}
Expand Down Expand Up @@ -99,7 +99,7 @@ def test_responses_svc_insight_https(
while (resp.json() != {"Total": 3, "Up": 3, "Unhealthy": 0}) and retry < 5:
resp = requests.get(req_url, verify=False)
wait_before_test()
retry = +1
retry = retry + 1
assert resp.status_code == 200, f"Expected 200 code for /probe/{host} but got {resp.status_code}"
assert resp.json() == {"Total": 3, "Up": 3, "Unhealthy": 0}

Expand Down Expand Up @@ -129,6 +129,6 @@ def test_responses_svc_insight_update_pods(
while (resp.json() != {"Total": 6, "Up": 6, "Unhealthy": 0}) and retry < 5:
resp = requests.get(req_url, verify=False)
wait_before_test()
retry = +1
retry = retry + 1
assert resp.status_code == 200, f"Expected 200 code for /probe/{host} but got {resp.status_code}"
assert resp.json() == {"Total": 6, "Up": 6, "Unhealthy": 0}
2 changes: 1 addition & 1 deletion tests/suite/test_watch_namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def test_response_codes(self, ingress_controller, backend_setup, expected_respon
retry = 0
while resp.status_code != expected_responses[ing] and retry < 3:
resp = requests.get(backend_setup.req_url, headers={"host": backend_setup.ingress_hosts[ing]})
retry = +1
retry = retry + 1
wait_before_test()
assert (
resp.status_code == expected_responses[ing]
Expand Down
12 changes: 6 additions & 6 deletions tests/suite/test_watch_namespace_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def test_response_codes(self, kube_apis, ingress_controller, backend_setup, expe
retry = 0
while resp.status_code != expected_responses[ing] and retry < 3:
resp = requests.get(backend_setup.req_url, headers={"host": backend_setup.resource_hosts[ing]})
retry = +1
retry = retry + 1
wait_before_test()
assert (
resp.status_code == expected_responses[ing]
Expand All @@ -155,7 +155,7 @@ def test_response_codes(self, kube_apis, ingress_controller, backend_setup, expe
ing = "foreign-ns-ingress"
while resp.status_code != 200 and retry < 3:
resp = requests.get(backend_setup.req_url, headers={"host": backend_setup.resource_hosts[ing]})
retry = +1
retry = retry + 1
wait_before_test()
assert (
resp.status_code == 200
Expand All @@ -169,7 +169,7 @@ def test_response_codes(self, kube_apis, ingress_controller, backend_setup, expe
retry = 0
while resp.status_code != expected_responses[ing] and retry < 3:
resp = requests.get(backend_setup.req_url, headers={"host": backend_setup.resource_hosts[ing]})
retry = +1
retry = retry + 1
wait_before_test()
assert (
resp.status_code == expected_responses[ing]
Expand Down Expand Up @@ -197,7 +197,7 @@ def test_response_codes(self, kube_apis, crd_ingress_controller, backend_setup_v
retry = 0
while resp.status_code != expected_responses[vs] and retry < 3:
resp = requests.get(backend_setup_vs.req_url, headers={"host": backend_setup_vs.resource_hosts[vs]})
retry = +1
retry = retry + 1
wait_before_test()
assert (
resp.status_code == expected_responses[vs]
Expand All @@ -212,7 +212,7 @@ def test_response_codes(self, kube_apis, crd_ingress_controller, backend_setup_v
vs = "foreign-ns-vs"
while resp.status_code != 200 and retry < 3:
resp = requests.get(backend_setup_vs.req_url, headers={"host": backend_setup_vs.resource_hosts[vs]})
retry = +1
retry = retry + 1
wait_before_test()
assert (
resp.status_code == 200
Expand All @@ -226,7 +226,7 @@ def test_response_codes(self, kube_apis, crd_ingress_controller, backend_setup_v
retry = 0
while resp.status_code != expected_responses[vs] and retry < 3:
resp = requests.get(backend_setup_vs.req_url, headers={"host": backend_setup_vs.resource_hosts[vs]})
retry = +1
retry = retry + 1
wait_before_test()
assert (
resp.status_code == expected_responses[vs]
Expand Down
2 changes: 1 addition & 1 deletion tests/suite/test_watch_secret_namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_responses(
except requests.exceptions.SSLError as e:
exception = str(e)
print(f"SSL certificate exception: {exception}")
retry = +1
retry = retry + 1

assert resp.status_code == 200

Expand Down

0 comments on commit e88a4f2

Please sign in to comment.