Skip to content

Commit e99023a

Browse files
committed
Update local dev docs
1 parent 2e139e0 commit e99023a

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

LOCAL_DEVELOPMENT_SETUP.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,17 @@ Close the scheme editor and run the application by selecting "Run" from the Xcod
3838
[ NOTICE ] Server starting on http://127.0.0.1:8080 [component: server]
3939
```
4040

41-
When Xcode opens the `Package.swift` file, it will auto-create a test plan based on all tests in the project. This works for most cases, but we need to tell Xcode to run our tests sequentially, not in parallel. The first thing to do is to persist the autocreated test plan. From the Product menu, select "Test Plan" then "Manage Test Plans...", then click the small arrow button:
41+
When working locally, it's helpful to have a database with pre-populated data from the live system. [Talk to us on Discord](https://discord.gg/vQRb6KkYRw), and we'll supply you with a recent database dump that you can load with `./scripts/load-db.sh`.
4242

43-
![A screenshot of Xcode's scheme editor showing a small arrow next to 'SPI-Server-Package (Autocreated)'.](.readme-images/manage-test-plans.png)
43+
### Running the tests
4444

45-
Once you open the autocreated test plan, you will be asked if you would like to persist the test plan. Click "Save" and accept the default location in the `.swiftpm` directory. Then, for each item in the test plan, click the "Options" and select "Enabled" for the "Parallelization" setting.
45+
The suite is capabale of running the tests in parallel against a database pool of configurable size. The default is 8 databases and it can be changed via the environment variable `DATABASEPOOL_SIZE`.
4646

47-
![A screenshot of Xcode's test plan editor showing the parallelization options.](.readme-images/test-plan-options.png)
47+
The docker test databases will be launched and configured automatically when the tests are run. They will remain active after the tests have completed. If you prefer to have the database containers removed when the tests finish running, set the environment variable `DATABASEPOOL_TEARDOWN` to `true` or `1`.
4848

49-
When working locally, it's helpful to have a database with pre-populated data from the live system. [Talk to us on Discord](https://discord.gg/vQRb6KkYRw), and we'll supply you with a recent database dump that you can load with `./scripts/load-db.sh`.
49+
If you have an existing server project, make sure parallel testing is enable for the test target via its `Options...`.
50+
51+
![A screenshot of Xcode's test plan editor showing the parallelization options.](.readme-images/test-plan-options.png)
5052

5153
### Setup the Front End
5254

Makefile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,6 @@ db-up: db-up-dev redis-up-dev
103103
db-up-dev:
104104
docker run --name spi_dev -e POSTGRES_DB=spi_dev -e POSTGRES_USER=spi_dev -e POSTGRES_PASSWORD=xxx -p 6432:5432 -d postgres:16-alpine
105105

106-
# NB: It is not required to bring up the test databases via this make target. The test runner will spawn databases
107-
# automatically. This can be configured via the environment variable:
108-
# DATABASEPOOL_SIZE
109-
# A good default for this is 8. Higher values don't improve performance much. If unset, this defaults to 4.
110-
# By setting the optional variable
111-
# DATABASEPOOL_TEARDOWN
112-
# the database containers will be removed after the test run completes. Default is `false`.
113106
db-up-ci:
114107
./scripts/start-ci-dbs.sh
115108

Tests/AppTests/Helpers/DatabasePool.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ extension Environment {
299299
if isRunningInCI() {
300300
8
301301
} else {
302-
Environment.get("DATABASEPOOL_SIZE").flatMap(Int.init) ?? 4
302+
Environment.get("DATABASEPOOL_SIZE").flatMap(Int.init) ?? 8
303303
}
304304
}
305305

0 commit comments

Comments
 (0)