Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 0 additions & 86 deletions .github/workflows/smoke-tests.yaml

This file was deleted.

53 changes: 52 additions & 1 deletion DEVNOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,55 @@ e.g.
```$ export OSS_INDEX_PASSWORD=<your API token>```

Run the dependency checker:
```$ mvn org.owasp:dependency-check-maven:check```
```$ mvn org.owasp:dependency-check-maven:check```

## Integration Testing

Integration tests live in `src/test/java/**/integration/` and are run as part
of the standard `mvn test` lifecycle — no special profile, external server, or
manual Postgres setup is required.

#### How they work

Each test class extends `ContainerTests`, which uses a JUnit 5
`DropwizardAppExtension` to boot the full application in-process against the
config at `src/test/resources/consent-ci.yaml`. A WireMock server on port 9999
stands in for all external services (Sam, ECM, GCS, etc.).

Database seeding is performed programmatically in `ContainerTests.seedDatabase()`
via typed DAO calls (`@BeforeAll`). The seed data is fully synthetic and
idempotent. To add new baseline rows, extend the relevant `seed*` helper method
inside `ContainerTests`.

#### Database

`ContainerTests` starts its own [Testcontainers](https://www.testcontainers.org/)
`PostgreSQLContainer` in a static initializer and passes the container's
coordinates directly to `DropwizardAppExtension` via `ConfigOverride`. The
hardcoded coordinates in `consent-ci.yaml` are never reached at runtime. No
local Postgres is needed in any environment.

#### How they run in CI

The GitHub Actions workflow at `.github/workflows/coverage.yaml` runs
`mvn clean test` on every push/PR to `develop`, which exercises unit and
integration tests together via Testcontainers — no additional CI configuration
is needed.

#### Running integration tests locally

**Integration tests only:**

```bash
mvn clean test -Dtest="org.broadinstitute.consent.integration.**"
```

**All tests** (unit + integration together, as CI does):

```bash
mvn clean test
```

**From the IDE:** run or debug any test class in the `integration` package
directly — `DAOTestHelper` activates automatically and provides the database.

46 changes: 0 additions & 46 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,52 +36,6 @@
<sonar.projectName>consent</sonar.projectName>
</properties>

<profiles>
<profile>
<id>all-tests</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
<!-- @{argLine} is necessary here so that the jacoco:prepare-agent output is included for tests -->
<!-- Updated configuration for mockito-->
<argLine>@{argLine} -Xmx1024m -XX:TieredStopAtLevel=1
-javaagent:${settings.localRepository}/org/mockito/mockito-core/${mockito.version}/mockito-core-${mockito.version}.jar
-Xshare:off
</argLine>
<includes>**/*.java</includes>
<excludes>**/integration/**/*.java</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>integration-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.version}</version>
<configuration>
<includes>**/integration/**/*.java</includes>
<systemProperties>
<enableTestContainers>false</enableTestContainers>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<build>
<testResources>
<testResource>
Expand Down
Loading
Loading