|
9 | 9 | import os
|
10 | 10 | import shutil
|
11 | 11 | import subprocess
|
12 |
| -import time |
13 | 12 | from subprocess import PIPE
|
14 | 13 | from typing import Any
|
15 | 14 |
|
16 |
| -import requests |
17 |
| - |
18 | 15 | from test_workflow.integ_test.utils import get_password
|
19 |
| -from validation_workflow.api_request import ApiTest |
20 | 16 | from validation_workflow.api_test_cases import ApiTestCases
|
21 | 17 | from validation_workflow.docker.inspect_docker_image import InspectDockerImage
|
22 | 18 | from validation_workflow.validation import Validation
|
@@ -79,7 +75,7 @@ def validation(self) -> bool:
|
79 | 75 | self.args.version
|
80 | 76 | )
|
81 | 77 | if return_code:
|
82 |
| - logging.info('Checking if cluster is ready for API test in every 10 seconds\n\n') |
| 78 | + logging.info('Checking if cluster is ready for API test in every 5 seconds\n\n') |
83 | 79 |
|
84 | 80 | if self.check_cluster_readiness():
|
85 | 81 | # STEP 4 . OS, OSD API validation
|
@@ -129,36 +125,6 @@ def cleanup_process(self) -> bool:
|
129 | 125 |
|
130 | 126 | return('returncode=0' in (str(result)))
|
131 | 127 |
|
132 |
| - def check_http_request(self) -> bool: |
133 |
| - self.test_readiness_urls = { |
134 |
| - 'https://localhost:9200': 'opensearch cluster API' |
135 |
| - } |
136 |
| - if 'opensearch-dashboards' in self.args.projects: |
137 |
| - self.test_readiness_urls['http://localhost:5601/api/status'] = 'opensearch-dashboards API' |
138 |
| - for url, name in self.test_readiness_urls.items(): |
139 |
| - try: |
140 |
| - status_code, response_text = ApiTest(url, self.args.version).api_get() |
141 |
| - if status_code != 200: |
142 |
| - logging.error(f'Error connecting to {name} ({url}): status code {status_code}') |
143 |
| - return False |
144 |
| - except (requests.exceptions.ConnectionError, requests.exceptions.ConnectTimeout) as e: |
145 |
| - logging.error(f'Error connecting to {name} ({url}): {e}') |
146 |
| - return False |
147 |
| - return True |
148 |
| - |
149 |
| - def check_cluster_readiness(self) -> bool: |
150 |
| - max_retry = 20 |
151 |
| - retry_count = 0 |
152 |
| - while retry_count < max_retry: |
153 |
| - logging.info(f'sleeping 10sec for retry {retry_count + 1}/{max_retry}') |
154 |
| - time.sleep(10) |
155 |
| - if self.check_http_request(): |
156 |
| - logging.info('\n\ncluster is now ready for API test\n\n') |
157 |
| - return True |
158 |
| - retry_count += 1 |
159 |
| - logging.error(f"Maximum number of retries ({max_retry}) reached. Cluster is not ready for API test.") |
160 |
| - return False |
161 |
| - |
162 | 128 | def get_artifact_image_name(self, artifact: str, using_staging_artifact_only: str) -> Any:
|
163 | 129 | self.image_names = {
|
164 | 130 | 'dockerhub': {
|
|
0 commit comments