Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_delete_sync_pod_timeout_error fails if delete succeeds very quickly #214

Open
RobertKrawitz opened this issue Aug 30, 2021 · 1 comment

Comments

@RobertKrawitz
Copy link
Member

test_delete_sync_pod_timeout_error is consistently failing for me as follows:


============================================================================================================================= FAILURES ==============================================================================================================================
________________________________________________________________________________________________________________ test_delete_sync_pod_timeout_error _________________________________________________________________________________________________________________

    def test_delete_sync_pod_timeout_error():
        """
        This method delete pod with timeout error
        :return:
        """
        oc = OC(kubeadmin_password=test_environment_variable['kubeadmin_password'])
        oc.login()
        oc.create_pod_sync(yaml=os.path.join(f'{templates_path}', 'stressng_pod.yaml'), pod_name='stressng-pod-workload')
        with pytest.raises(PodTerminateTimeout) as err:
>           oc.delete_pod_sync(yaml=os.path.join(f'{templates_path}', 'stressng_pod.yaml'), pod_name='stressng-pod-workload', timeout=0)
E           Failed: DID NOT RAISE <class 'benchmark_runner.common.oc.oc_exceptions.PodTerminateTimeout'>

tests/integration/benchmark_runner/common/oc/test_oc.py:190: Failed

The problem is that the pod delete is completing very quickly, so doesn't actually fail. This change in wait_for_pod_terminate allows it to pass:

index eab9aed..54cf895 100644
@@ -205,7 +206,7 @@ class OC(SSH):
         :return: True if pod name terminated or raise
         """
         current_wait_time = 0
-        while current_wait_time <= timeout:
+        while current_wait_time < timeout:
             if not self._is_pod_exist(pod_name=pod_name, namespace=namespace):
                 return True
             # sleep for x seconds

The test should not assume that the deletion will take non-zero time.

@RobertKrawitz
Copy link
Member Author

Actually, a better fix would be to change the timeout to be -1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant