Fix critical regression in tiled serve directory
#701
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The CLI had no unit tests (see #518) because there were some subtle issues to think through about how to do that. This enabled a critical regression to slip though in #661 that fully broke
tiled serve directory ...
. The regression was not immediately noticed becausetiled serve directory
is kind of a "toy" entrypoint: it doesn't scale, but it's really great for demos and for early users trying out tiled.In #661, the process of registering external files with Tiled changed from being a server-side activity, with direct access to the SQL database, to a client-side activity, performed via HTTP requests. The
tiled serve directory ...
CLI entrypoint was not correctly updated to account for this change.In this PR, the regression is fixed. Additionally, some basic unit tests are added to protect against future regressions. More unit tests should be added in follow-up PRs, but this provides a framework. The critical thing is enabling the tests to start a server on a high random free port, specified by the OS, extract which port is being used, and run a basic HTTP
GET
to confirm that the server is alive.Additionally, interactive tests: