Faster test runs!

Test runs should run faster now, we’ve made 2 changes:

  • Expanded the Turbo test runner pool, so if you’re using a free challenge you should see turbo test runs more often.

  • Changed the order of tests. Instead of stage 1, stage 2 … stage N, we’re now doing stage N, stage N-1 … stage 1. This means that when your tests fail, you should see the failure quicker.


Want to note that there are some potential downsides to the test order change:

(a) you might pass a stage and then after that realize that “oh tests for the previous stages are failing now, hadn’t thought that I need to pass those too”.
(b) once you’ve marked a stage as complete, there’s no way to go back and run tests for older stages until you pass the current stage. So you can’t “refactor after completing” unless you do it before marking a stage as complete.

If you run into either of these, please let us know! We’d love to explore ways to fix them and hear any ideas you have.

I do not know whether it is related or not, but I recently started seing the following error for “Build your own HTTP server” challenge (Stage 8):

[stage-8] Running tests for Stage #8: Post a file
[stage-8] $ ./ --directory /tmp/data/
[stage-8] You can use the following curl command to test this locally
[stage-8] $ curl -v -X POST http://localhost:4221/files/237_scooby_dumpty_dooby -d '237 Coo scooby yikes Horsey 237 dooby Coo'
[stage-8] Sending request (status line): POST /files/237_scooby_dumpty_dooby HTTP/1.1
[your_program] 2024-04-28T00:12:03 [main] [INFO] me.httpserver.server.HttpServer - Starting with working directory: /tmp/data/ on port: 4221
[your_program] Accepted new connection. Thread: Thread-4
[your_program] Error writing file: /tmp/data/
[your_program] java.nio.file.NoSuchFileException: /tmp/data/
[your_program]  at java.base/sun.nio.fs.UnixException.translateToIOException(
[your_program]  at java.base/sun.nio.fs.UnixException.rethrowAsIOException(
[your_program]  at java.base/sun.nio.fs.UnixException.rethrowAsIOException(
[your_program]  at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(
[your_program]  at java.base/java.nio.file.spi.FileSystemProvider.newOutputStream(
[your_program]  at java.base/java.nio.file.Files.newOutputStream(
[your_program]  at java.base/java.nio.file.Files.write(
[your_program]  at java.base/java.nio.file.Files.writeString(
[your_program]  at java.base/java.nio.file.Files.writeString(
[your_program]  at me.httpserver.handler.HttpRequestHandler.constructResponse(
[your_program]  at
[stage-8] Expected status code 201, got 400
[stage-8] Test failed (try setting 'debug: true' in your codecrafters.yml to see more details)

It looks like the working directory that are passed to my server does not exists: /tmp/data/

P.S: The same code worked several hours before

Hey @ma1anga - thanks for reporting! Indeed, this does look like a side-effect of the change - the directly was being created by stage 7 and used by stage 8. We’re fixing this!

1 Like

Fixed in Add 1 pass_all test + fix stage ordering issue by rohitpaulk · Pull Request #43 · codecrafters-io/http-server-tester · GitHub!

1 Like

I can confirm that this issue is fixed. Thanks!

1 Like