@@ -109,8 +109,15 @@ jobs:
109109 cd spice_qs
110110 spice add spiceai/quickstart
111111 spiced &> spice.log &
112- # time to initialize added dataset
113- sleep 10
112+ # Wait for runtime to be ready (poll /v1/ready endpoint)
113+ for i in {1..60}; do
114+ if curl -s http://localhost:8090/v1/ready > /dev/null 2>&1; then
115+ echo "Spice runtime is ready"
116+ break
117+ fi
118+ echo "Waiting for Spice runtime to be ready... ($i/60)"
119+ sleep 1
120+ done
114121
115122 - name : Init and start spice app (Windows)
116123 if : matrix.os == 'windows-latest'
@@ -119,15 +126,29 @@ jobs:
119126 cd spice_qs
120127 spice add spiceai/quickstart
121128 Start-Process -FilePath spice run
122- # time to initialize added dataset
123- Start-Sleep -Seconds 10
129+ # Wait for runtime to be ready (poll /v1/ready endpoint)
130+ $timeout = 60
131+ $elapsed = 0
132+ while ($elapsed -lt $timeout) {
133+ try {
134+ $response = Invoke-WebRequest -Uri "http://localhost:8090/v1/ready" -UseBasicParsing -TimeoutSec 2 -ErrorAction Stop
135+ if ($response.StatusCode -eq 200) {
136+ Write-Host "Spice runtime is ready"
137+ break
138+ }
139+ } catch {
140+ Write-Host "Waiting for Spice runtime to be ready... ($elapsed/$timeout)"
141+ }
142+ Start-Sleep -Seconds 1
143+ $elapsed++
144+ }
124145 shell : pwsh
125146
126147 - name : Running tests
127148 env :
128149 API_KEY : ${{ secrets.API_KEY }}
129150 # run spice.ai cloud tests only on linux with single python version, to avoid concurrent requests
130- TEST_SPICE_CLOUD : " false"
151+ TEST_SPICE_CLOUD : ' false'
131152 run : |
132153 pytest -s tests/test_main.py -k "not cloud"
133154
@@ -158,7 +179,7 @@ jobs:
158179 - name : Run cloud tests
159180 env :
160181 SPICE_API_KEY : ${{ secrets.SCP_SPICEAI_TPCH_API_KEY }}
161- TEST_SPICE_CLOUD : " true"
182+ TEST_SPICE_CLOUD : ' true'
162183 run : |
163184 pytest -s tests/test_main.py -k "cloud"
164185
@@ -184,7 +205,7 @@ jobs:
184205 pytest --cov=spicepy --cov-report=xml --cov-report=term-missing --ignore=tests/test_main.py tests/
185206 - name : Upload coverage to Codecov
186207 if : matrix.python-version == '3.12'
187- uses : codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v4.5.0
208+ uses : codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v4.5.0
188209 with :
189210 files : ./coverage.xml
190211 fail_ci_if_error : false
0 commit comments