Skip to content
Closed
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
11 changes: 8 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
run: ./generate.sh

- name: Set up JDK 17
uses: actions/setup-java@v4
uses: actions/setup-java@v5.6.0
with:
java-version: '17'
distribution: 'temurin'
Expand All @@ -33,14 +33,19 @@ jobs:
run: mvn resources:resources --file src/pom.xml

- name: Test
if: ${{ github.actor != 'dependabot[bot]' }}
run: mvn --batch-mode -Dmaven.test.failure.ignore=true test --file src/pom.xml
env:
DATASET_ID: ${{secrets.INTEGRATIONTESTS_DATASET_ID}}
API_KEY: ${{secrets.INTEGRATIONTESTS_API_KEY}}

- name: Unit tests
if: ${{ github.actor == 'dependabot[bot]' }}
run: mvn --batch-mode -DexcludedGroups=integration test --file src/pom.xml

- name: Report
uses: dorny/test-reporter@v1
if: always()
uses: dorny/test-reporter@v3
if: ${{ always() && github.actor != 'dependabot[bot]' }}
with:
name: Maven Tests
path: src/target/surefire-reports/*.xml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate-api-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
"Resolved Relewise.Client version $version." >> $env:GITHUB_STEP_SUMMARY

- name: Set up JDK 17
uses: actions/setup-java@v4
uses: actions/setup-java@v5.6.0
with:
java-version: '17'
distribution: 'temurin'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: ./generate.sh

- name: Set up JDK 17 and Maven Central auth
uses: actions/setup-java@v5
uses: actions/setup-java@v5.6.0
with:
distribution: 'temurin'
java-version: '17'
Expand Down
9 changes: 8 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,16 @@ Run tests:
mvn --batch-mode test --file src/pom.xml
```

Run tests that do not require integration credentials:

```powershell
mvn --batch-mode -DexcludedGroups=integration test --file src/pom.xml
```

## Testing and Credentials
- Tests use `DATASET_ID` and `API_KEY` from environment (`TestBase`).
- Integration tests inherit the `integration` tag and use `DATASET_ID` and `API_KEY` from the environment (`TestBase`).
- CI injects credentials from secrets.
- CI excludes integration tests when triggered by Dependabot.
- If credentials are unavailable locally, explicitly report integration-style test coverage as not run.

## Validation Policy (CI-Aligned, Pragmatic)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import static org.junit.jupiter.api.Assertions.*;

public class ClientConstructionTest extends TestBase {
public class ClientConstructionTest {
@Test
public void testApiKeyEmpty() {
assertThrows(IllegalArgumentException.class, () -> new Tracker("00000000-0000-0000-0000-000000000001", "", "https://api.relewise.com/"));
Expand All @@ -24,4 +24,4 @@ public void testApiKeyValid() {

assertNotNull(tracker);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import static org.junit.jupiter.api.Assertions.*;

public class DateTimeSerializationTest extends TestBase {
public class DateTimeSerializationTest {
@Test
public void testSerializeOffsetDateTime() throws Exception {
var objectMapper = JsonMapper.builder()
Expand Down Expand Up @@ -42,4 +42,4 @@ public void testSerializeLocalDateTime() throws Exception {

assertEquals("\"" + input + "\"", serialized);
}
}
}
3 changes: 3 additions & 0 deletions src/src/test/java/com/relewise/client/TestBase.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.relewise.client;

import org.junit.jupiter.api.Tag;

@Tag("integration")
public abstract class TestBase {

public static String GetDatasetId() {
Expand Down
Loading