Skip to content

Commit f2407c7

Browse files
slayerjainclaude
andcommitted
revert: drop H2 + in-test DB override in smoke test
Per product direction, the e2e/sample path MUST exercise real Postgres + Flyway so Keploy is forced to correctly capture the full wire-protocol footprint — including the Flyway bootstrap/migration queries. Swapping the datasource for H2 at test time would hide exactly the behaviour the sample is meant to regress. Restores the Customer360ApplicationTests to its pre-review shape and drops the H2 test dependency. The test assumes a live Postgres on localhost:5432 (docker-compose.yml brings it up); added a Javadoc note so future readers don't re-H2 it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 679fc8b commit f2407c7

2 files changed

Lines changed: 9 additions & 18 deletions

File tree

sap-demo-java/pom.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,6 @@
125125
<artifactId>spring-boot-starter-test</artifactId>
126126
<scope>test</scope>
127127
</dependency>
128-
<!-- H2 replaces Postgres at test time (@AutoConfigureTestDatabase) so
129-
the context-load smoke test can run without a live DB. -->
130-
<dependency>
131-
<groupId>com.h2database</groupId>
132-
<artifactId>h2</artifactId>
133-
<scope>test</scope>
134-
</dependency>
135128
</dependencies>
136129

137130
<build>

sap-demo-java/src/test/java/com/tricentisdemo/sap/customer360/Customer360ApplicationTests.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,29 @@
11
package com.tricentisdemo.sap.customer360;
22

33
import org.junit.jupiter.api.Test;
4-
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
54
import org.springframework.boot.test.context.SpringBootTest;
65
import org.springframework.test.context.TestPropertySource;
76

87
/**
98
* Minimal context-load smoke test. Verifies the Spring wiring is correct —
109
* RestTemplate, interceptors, executor, Resilience4j decorators all bind.
1110
*
12-
* <p>{@link AutoConfigureTestDatabase} replaces the configured Postgres
13-
* with an in-memory H2 at test time so this test can run in environments
14-
* without a live DB. Flyway is disabled for the same reason (migrations
15-
* are Postgres-specific); Hibernate creates the schema from entities.
11+
* <p><b>This test expects a live Postgres instance on localhost:5432</b>
12+
* (see docker-compose.yml). That is deliberate: the sample exists to
13+
* validate that Keploy correctly captures real Postgres traffic —
14+
* including the Flyway bootstrap queries — so swapping the datasource
15+
* for H2 would hide exactly the wire-protocol behaviour we regress.
16+
* Bring the compose stack up (`docker compose up -d postgres`) before
17+
* running tests, or run via the CI pipeline where Postgres is provisioned.
1618
*
1719
* <p>The full integration test suite is intentionally out of scope for
1820
* this reference service: the regression layer is provided by Keploy
19-
* mocks recorded from real SAP traffic. That is the whole point of the
20-
* demo.
21+
* mocks recorded from real SAP traffic.
2122
*/
2223
@SpringBootTest
23-
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.ANY)
2424
@TestPropertySource(properties = {
2525
"sap.api.base-url=https://example.invalid",
26-
"sap.api.key=test-key",
27-
"spring.flyway.enabled=false",
28-
"spring.jpa.hibernate.ddl-auto=create-drop"
26+
"sap.api.key=test-key"
2927
})
3028
class Customer360ApplicationTests {
3129

0 commit comments

Comments
 (0)