Skip to content

Commit

Permalink
Break down testing instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Feb 26, 2025
1 parent d0eb7fc commit 45fd270
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,29 @@ Clone the repo and fetch its dependencies:
$ git clone https://github.com/elixir-ecto/ecto_sql.git
$ cd ecto_sql
$ mix deps.get
$ mix test.all
$ mix test

Note that `mix test.all` runs the tests in `test/` and the `integration_test`s for each adapter: `pg`, `myxql` and `tds`.

You can also use a local Ecto checkout if desired:
In case you are modifying Ecto and EctoSQL at the same time, you can configure EctoSQL to use an Ecto version from your machine by running:

$ ECTO_PATH=../ecto mix test.all

You can run tests against a specific Ecto adapter by using the `ECTO_ADAPTER` environment variable:
### Running integration tests

The command above will run unit tests. EctoSQL also has a suite of integration tests for its built-in adapters: `pg`, `myxql` and `tds`. If you are changing logic specific to a database, we recommend running its respective integration test suite as well. Doing so requires you to have the database available locally. MySQL and PostgreSQL can be installed directly on most systems. For MSSQL, you may need to run it as a Docker image:

docker run -d -p 1433:1433 --name mssql -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=some!Password' mcr.microsoft.com/mssql/server:2017-latest

Once the database is running, you can run tests against a specific Ecto adapter by using the `ECTO_ADAPTER` environment variable:

$ ECTO_ADAPTER=pg mix test

MySQL and PostgreSQL can be installed directly on most systems. For MSSQL, you may need to run it as a Docker image:
You may also run `mix test.all` to run the unit tests and all integration tests. You can also use a local Ecto checkout if desired:

docker run -d -p 1433:1433 --name mssql -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=some!Password' mcr.microsoft.com/mssql/server:2017-latest
$ ECTO_PATH=../ecto mix test.all

### Running containerized tests

It is also possible to run the integration tests under a containerized environment using [earthly](https://earthly.dev/get-earthly):
It is also possible to run the integration tests under a containerized environment using [earthly](https://earthly.dev/get-earthly). You will also need Docker installed on your system. Then you can run:

$ earthly -P +all

Expand Down
2 changes: 1 addition & 1 deletion lib/ecto/adapters/postgres.ex
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ defmodule Ecto.Adapters.Postgres do
* `:lc_collate` - the collation order
* `:lc_ctype` - the character classification
* `:dump_path` - where to place dumped structures
* `dump_prefixes` - list of prefixes that will be included in the structure dump.
* `:dump_prefixes` - list of prefixes that will be included in the structure dump.
When specified, the prefixes will have their definitions dumped along with the
data in their migration table. When it is not specified, the configured
database has the definitions dumped from all of its schemas but only
Expand Down

0 comments on commit 45fd270

Please sign in to comment.