Skip to content

Commit d535370

Browse files
committed
refactor: use TestContainers
1 parent de98fe0 commit d535370

12 files changed

Lines changed: 1915 additions & 399 deletions

File tree

.github/workflows/rust.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,6 @@ jobs:
173173
- name: Build
174174
run: cargo build --all-features --tests
175175

176-
- name: Run the external dependencies
177-
run: docker compose up -d --wait
178-
179176
- name: Test
180177
run: cargo nextest run --all-features --run-ignored only
181178

@@ -221,9 +218,6 @@ jobs:
221218
- name: Run sccache-cache
222219
uses: mozilla-actions/sccache-action@v0.0.9
223220

224-
- name: Run the external dependencies
225-
run: docker compose up -d
226-
227221
- name: Install cargo-llvm-cov
228222
uses: taiki-e/install-action@cargo-llvm-cov
229223

CONTRIBUTING.md

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,11 @@ instructions. This handles formatting of all the files in the repository.
4646
### Tests that use database, cache, or other external resources
4747

4848
Some tests use a database, cache, or other external resources. All these tests
49-
are marked with `#[ignore]`, so they are not run by default.
49+
are marked with `#[ignore]`, but they will automatically start the necessary
50+
containers using [Testcontainers](https://testcontainers.org/) if you have
51+
Docker or a similar container runtime installed.
5052

51-
If you want to run the full test suite, it's necessary to run these external
52-
dependencies. For convenience, Cot provides a
53-
[Docker compose file](./compose.yml) in the root of the repository that
54-
contains all the dependencies needed to run the tests. You can run it with:
55-
56-
```sh
57-
docker compose up -d
58-
```
59-
60-
Then, the tests can be run with:
53+
If you want to run the full test suite, you can run:
6154

6255
```sh
6356
cargo test --all-features --include-ignored
@@ -66,17 +59,11 @@ cargo test --all-features --include-ignored
6659
#### End-to-end tests
6760

6861
End-to-end tests require a running webdriver server. By default, a Selenium
69-
Grid server is used (included in the `compose.yml` file). You can access the
70-
UI to see the tests running (for example, to debug them) at
71-
`http://localhost:7900/?autoconnect=1&resize=scale&password=secret`.
72-
73-
Alternatively, instead of using Selenium Grid, you can run the tests with
74-
a local webdriver server. To do this, you need to install and run the
75-
Webdriver implementation of your choice, such as
76-
[geckodriver](https://github.com/mozilla/geckodriver/releases) or
77-
[chromedriver](https://developer.chrome.com/docs/chromedriver/downloads).
78-
After running the webdriver server, you will see the tests running in a
79-
local browser window.
62+
container is automatically started using Testcontainers.
63+
64+
Alternatively, you can run the tests with a local webdriver server. To do this,
65+
you need to set the `WEBDRIVER_URL` environment variable to the URL of your
66+
local webdriver server (e.g., `http://localhost:4444`).
8067

8168
### Snapshot tests
8269

0 commit comments

Comments
 (0)