Skip to content

Commit dd992d8

Browse files
committed
Adopt classic spring-boot-starter-web / -test; harden seed.sh with set -e
- pom.xml: use spring-boot-starter-web and the aggregate spring-boot-starter-test instead of the 4.x modular starters. Both resolve on 4.1.0 (verified), but the classic starters are the conventional choice for a sample; -web still brings embedded Tomcat (tomcat-embed-core 11.0.22) + spring-webmvc. - seed.sh: enable 'set -e' so a failure in any phase (not just create()) aborts loudly. Hardened id_of to 'grep -m1' (no downstream head -> no SIGPIPE) so the pipeline stays clean under -e + pipefail, and guarded the id extraction with '|| true' to preserve the friendly no-id error. Signed-off-by: dhananjay6561 <dhananjayaggarwal6561@gmail.com>
1 parent ab109ec commit dd992d8

2 files changed

Lines changed: 7 additions & 20 deletions

File tree

spring-boot-product-catalog/pom.xml

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</dependency>
3232
<dependency>
3333
<groupId>org.springframework.boot</groupId>
34-
<artifactId>spring-boot-starter-webmvc</artifactId>
34+
<artifactId>spring-boot-starter-web</artifactId>
3535
</dependency>
3636

3737
<dependency>
@@ -41,22 +41,7 @@
4141
</dependency>
4242
<dependency>
4343
<groupId>org.springframework.boot</groupId>
44-
<artifactId>spring-boot-starter-actuator-test</artifactId>
45-
<scope>test</scope>
46-
</dependency>
47-
<dependency>
48-
<groupId>org.springframework.boot</groupId>
49-
<artifactId>spring-boot-starter-data-jpa-test</artifactId>
50-
<scope>test</scope>
51-
</dependency>
52-
<dependency>
53-
<groupId>org.springframework.boot</groupId>
54-
<artifactId>spring-boot-starter-validation-test</artifactId>
55-
<scope>test</scope>
56-
</dependency>
57-
<dependency>
58-
<groupId>org.springframework.boot</groupId>
59-
<artifactId>spring-boot-starter-webmvc-test</artifactId>
44+
<artifactId>spring-boot-starter-test</artifactId>
6045
<scope>test</scope>
6146
</dependency>
6247
</dependencies>

spring-boot-product-catalog/seed.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
# Keploy suite is broad: ~50 test cases covering the full CRUD lifecycle across several
66
# categories, filtering, and a wide range of 400 (validation) and 404 (not-found) paths.
77
# Ids returned by POST are chained into later GET/PUT/DELETE calls so the suite is coherent.
8-
set -uo pipefail
8+
set -euo pipefail
99

1010
BASE="${BASE:-http://localhost:8080}"
1111

1212
# --- helpers -----------------------------------------------------------------
13-
id_of() { grep -o '"id":[0-9]*' | head -1 | cut -d: -f2; }
13+
# grep -m1 stops after the first match and exits 0 (no SIGPIPE from a downstream `head`),
14+
# so it stays well-behaved under `set -e` + `pipefail`.
15+
id_of() { grep -m1 -o '"id":[0-9]*' | cut -d: -f2; }
1416

1517
CREATED=() # ids of products created, in order
1618

@@ -22,7 +24,7 @@ create() {
2224
exit 1
2325
fi
2426
echo " created: $body"
25-
id=$(printf '%s' "$body" | id_of)
27+
id=$(printf '%s' "$body" | id_of || true)
2628
if [ -z "$id" ]; then
2729
echo " ERROR: no id in create response: $body" >&2
2830
exit 1

0 commit comments

Comments
 (0)