Skip to content

Commit ebf749d

Browse files
authored
chore: [DevOps] E2E Test Matrix Build (#193)
* Add E2E Test Matrix Builds * Update * Adjust service key * Update e2e-test.yaml * Proper usage of secrets in matrix * Set temperature to 0 to stabilize tests
1 parent 71dceee commit ebf749d

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

.github/workflows/e2e-test.yaml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,24 @@ name: "End-to-end Tests"
22
on:
33
workflow_dispatch:
44
schedule:
5-
- cron: 0 2 * * *
5+
- cron: 15 2 * * MON-FRI
66

77
env:
88
MVN_MULTI_THREADED_ARGS: --batch-mode --no-transfer-progress --fail-at-end --show-version --threads 1C
99
JAVA_VERSION: 17
1010

1111
jobs:
12-
1312
end-to-end-tests:
14-
# https://wiki.one.int.sap/wiki/display/DevFw/SUGAR
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
environment: [ canary, production ]
17+
exclude:
18+
- environment: production
19+
# secret-name: AI_CORE_PRODUCTION
20+
include:
21+
- environment: canary
22+
secret-name: AI_CORE_CANARY
1523
runs-on: ubuntu-latest
1624
steps:
1725

@@ -33,10 +41,10 @@ jobs:
3341
- name: "Run tests"
3442
run: |
3543
MVN_ARGS="${{ env.MVN_MULTI_THREADED_ARGS }} surefire:test -pl :spring-app -DskipTests=false"
36-
mvn $MVN_ARGS
44+
mvn $MVN_ARGS "-Daicore.landscape=${{ matrix.environment }}"
3745
env:
3846
# See "End-to-end test application instructions" on the README.md to update the secret
39-
AICORE_SERVICE_KEY: ${{ secrets.AICORE_SERVICE_KEY }}
47+
AICORE_SERVICE_KEY: ${{ secrets[matrix.secret-name] }}
4048

4149
- name: "Start Application Locally"
4250
run: |
@@ -53,7 +61,7 @@ jobs:
5361
done
5462
env:
5563
# See "End-to-end test application instructions" on the README.md to update the secret
56-
AICORE_SERVICE_KEY: ${{ secrets.AICORE_SERVICE_KEY }}
64+
AICORE_SERVICE_KEY: ${{ secrets[matrix.secret-name] }}
5765

5866
- name: "Health Check"
5967
# print response body with headers to stdout. q:body only O:print -:stdout S:headers

sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/OrchestrationController.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
@RequestMapping("/orchestration")
2626
class OrchestrationController {
2727
private final OrchestrationClient client = new OrchestrationClient();
28-
OrchestrationModuleConfig config = new OrchestrationModuleConfig().withLlmConfig(GPT_35_TURBO);
28+
OrchestrationModuleConfig config =
29+
new OrchestrationModuleConfig()
30+
.withLlmConfig(GPT_35_TURBO.withParams(Map.of("temperature", 0.0)));
2931

3032
/**
3133
* Chat request to OpenAI through the Orchestration service with a simple prompt.

sample-code/spring-app/src/test/java/com/sap/ai/sdk/app/controllers/OrchestrationTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import lombok.extern.slf4j.Slf4j;
1313
import org.junit.jupiter.api.BeforeEach;
1414
import org.junit.jupiter.api.Test;
15+
import org.junit.jupiter.api.condition.DisabledIfSystemProperty;
1516

1617
@Slf4j
1718
class OrchestrationTest {
@@ -148,4 +149,11 @@ void testMaskingPseudonymization() {
148149
.doesNotContain("MASKED_PERSON")
149150
.contains("Mallory");
150151
}
152+
153+
@Test
154+
@DisabledIfSystemProperty(named = "aicore.landscape", matches = "production")
155+
void testGrounding() {
156+
// Placeholder for grounding test
157+
assertThat(System.getProperty("aicore.landscape")).isNotEqualTo("production");
158+
}
151159
}

0 commit comments

Comments
 (0)