|
133 | 133 | ]; |
134 | 134 | }; |
135 | 135 | docker = lib.recursiveUpdate publishPackages { |
136 | | - # TODO: For debugging |
137 | | - # needs = [ "nix-fast-build" ]; |
| 136 | + needs = [ "nix-fast-build" ]; |
138 | 137 | steps = |
139 | 138 | let |
140 | 139 |
|
|
158 | 157 | }; |
159 | 158 | }; |
160 | 159 |
|
| 160 | + dockerPort = builtins.toString 2718; |
| 161 | + |
161 | 162 | in |
162 | 163 | baseNixSteps |
163 | 164 | ++ [ |
|
167 | 168 |
|
168 | 169 | } |
169 | 170 | { |
170 | | - name = "Run fractopo-app container"; |
| 171 | + name = "Test run of loaded fractopo-app container"; |
171 | 172 | run = |
172 | 173 | let |
173 | 174 | inherit (inputs.self.legacyPackages.x86_64-linux.fractopo-app-image-stream) imageName imageTag; |
174 | 175 | in |
175 | | - "docker run -d --name fractopo-test -p 2718:2718 ${imageName}:${imageTag}"; |
| 176 | + "docker run -d --name fractopo-test -p ${dockerPort}:${dockerPort} ${imageName}:${imageTag}"; |
176 | 177 | } |
177 | 178 | { |
178 | 179 | name = "Wait for API to be ready"; |
179 | 180 | run = '' |
180 | | - for i in {1..30}; do |
181 | | - if curl -s http://localhost:2718/; then |
| 181 | + for i in {1..60}; do |
| 182 | + if curl -s http://localhost:${dockerPort}/; then |
182 | 183 | echo "API is up!" |
183 | 184 | exit 0 |
184 | 185 | fi |
|
190 | 191 | } |
191 | 192 | { |
192 | 193 | name = "Test API root endpoint"; |
193 | | - run = "curl -f http://localhost:2718/"; |
| 194 | + run = "curl -f http://localhost:${dockerPort}/"; |
194 | 195 | } |
195 | 196 | (mkPushStep { |
196 | 197 | rev = "$(git rev-parse --short HEAD)"; |
|
227 | 228 | strategy = { |
228 | 229 | fail-fast = false; |
229 | 230 | matrix = { |
| 231 | + # Test same Python versions as for poetry job |
230 | 232 | inherit (config.workflows.".github/workflows/main.yaml".jobs.poetry.strategy.matrix) |
231 | 233 | python-version |
232 | 234 | ; |
|
255 | 257 | }; |
256 | 258 | } |
257 | 259 | { |
| 260 | + name = "Test package import"; |
258 | 261 | run = '' |
259 | | - echo "Testing package import" |
260 | 262 | python -c 'import fractopo' |
261 | | - echo "Testing module entrypoint" |
| 263 | + ''; |
| 264 | + } |
| 265 | + { |
| 266 | + name = "Test module entrypoint"; |
| 267 | + run = '' |
262 | 268 | python -m fractopo --help |
263 | | - echo "Running unittests with pytest" |
| 269 | + ''; |
| 270 | + } |
| 271 | + { |
| 272 | + name = "Run unittests with pytest"; |
| 273 | + run = '' |
264 | 274 | pytest -v |
265 | 275 | ''; |
266 | 276 | } |
|
0 commit comments