Skip to content

Commit 8d38bb4

Browse files
committed
CI fixes
1 parent 0439434 commit 8d38bb4

2 files changed

Lines changed: 31 additions & 15 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
ports:
2020
- 8080:8080
2121
petstore-oas3:
22-
image: swaggerapi/petstore-v3
22+
image: openapitools/openapi-petstore
2323
ports:
2424
- 8081:8080
2525
steps:
@@ -75,7 +75,7 @@ jobs:
7575
ports:
7676
- 8080:8080
7777
petstore-oas3:
78-
image: swaggerapi/petstore-v3
78+
image: openapitools/openapi-petstore
7979
ports:
8080
- 8081:8080
8181
steps:

scripts/run_petstore_test.py

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,24 +62,35 @@ def main():
6262
import urllib.request
6363

6464
default_port = 8081 if is_oas3 else 8080
65-
test_url = (
66-
f"http://localhost:{default_port}/api/v3/swagger.json"
65+
test_urls = (
66+
[
67+
f"http://localhost:{default_port}/api/v3/openapi.json",
68+
f"http://localhost:{default_port}/api/v3/swagger.json",
69+
f"http://localhost:{default_port}/v3/openapi.json",
70+
]
6771
if is_oas3
68-
else f"http://localhost:{default_port}/api/swagger.json"
72+
else [f"http://localhost:{default_port}/api/swagger.json"]
6973
)
7074

7175
try:
72-
print(f"Checking if existing mock server is pingable at {test_url}...")
73-
urllib.request.urlopen(test_url, timeout=2)
74-
host_port = str(default_port)
75-
print(f"Found active mock server on port {host_port}")
76+
print(f"Checking if existing mock server is pingable at {test_urls}...")
77+
for t_url in test_urls:
78+
try:
79+
urllib.request.urlopen(t_url, timeout=2)
80+
host_port = str(default_port)
81+
print(f"Found active mock server on port {host_port} at {t_url}")
82+
break
83+
except Exception:
84+
continue
7685
except Exception:
7786
print("No active mock server found.")
7887

7988
if not host_port:
8089
print("Falling back to Docker JVM Petstore server...")
8190
container_name = f"petstore_server_{os.getpid()}"
82-
image_name = "swaggerapi/petstore-v3" if is_oas3 else "swaggerapi/petstore"
91+
image_name = (
92+
"openapitools/openapi-petstore" if is_oas3 else "swaggerapi/petstore"
93+
)
8394

8495
fallback_image_name = (
8596
"openapitools/openapi-petstore"
@@ -133,12 +144,17 @@ def main():
133144
try:
134145
for _ in range(15):
135146
time.sleep(2)
136-
try:
137-
urllib.request.urlopen(test_url, timeout=1)
138-
print("Docker mock server is ready.")
147+
success = False
148+
for t_url in test_urls:
149+
try:
150+
urllib.request.urlopen(t_url, timeout=1)
151+
print(f"Docker mock server is ready at {t_url}")
152+
success = True
153+
break
154+
except Exception:
155+
pass
156+
if success:
139157
break
140-
except Exception:
141-
pass
142158
else:
143159
print("Docker mock server failed to become ready.")
144160
return

0 commit comments

Comments
 (0)