You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: labs/lab-7/README.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,16 +2,16 @@
2
2
3
3
## Learning Objectives
4
4
5
-
- Configure JUnit 5 parallel test execution via `junit-platform.properties`
6
-
- Understand the difference between JUnit 5 thread-level parallelism and Maven Surefire `forkCount` process-level forking
5
+
- Configure JUnit 6 parallel test execution via `junit-platform.properties`
6
+
- Understand the difference between JUnit 6 thread-level parallelism and Maven Surefire `forkCount` process-level forking
7
7
- Identify and fix test isolation issues caused by shared database state
8
8
- Apply `@Transactional` and UUID-based unique data as complementary isolation strategies
9
9
10
10
## Key Concepts
11
11
12
-
### JUnit 5 Parallel Execution
12
+
### JUnit 6 Parallel Execution
13
13
14
-
JUnit 5 supports running tests in parallel at both the class level and the method level. Configuration lives in `src/test/resources/junit-platform.properties`.
14
+
JUnit 6 supports running tests in parallel at both the class level and the method level. Configuration lives in `src/test/resources/junit-platform.properties`.
15
15
16
16
There are two independent axes of parallelism:
17
17
@@ -71,12 +71,12 @@ src/test/resources/
71
71
72
72
### Exercise 1: Configure and Observe Parallel Test Execution
73
73
74
-
Understand JUnit 5 parallel execution configuration and observe its effect on thread allocation.
74
+
Understand JUnit 6 parallel execution configuration and observe its effect on thread allocation.
75
75
76
76
**Tasks:**
77
77
1. Open `src/test/resources/junit-platform.properties` and review the current settings
78
78
2. Open `Exercise1ParallelExecutionTest.java` — the test methods print the current thread name
79
-
3. Run `mvn test` and observe which threads each test class runs on in the console output
79
+
3. Run `mvn test`or within IntelliJ and observe which threads each test class runs on in the console output
80
80
4. Try different parallelism strategies by modifying `junit-platform.properties`:
Style violations and formatting errors fail **locally in milliseconds** - not 5 minutes into a CI run. Less noise in PRs, faster feedback loop.
598
+
599
+
600
+
---
601
+
602
+
## Best Practice 0: Never Go Stale
603
+
604
+
**Deploy or run at least once a week** - even if nobody pushed code.
605
+
606
+
```yaml
607
+
# .github/workflows/nightly.yml
608
+
name: Nightly Verification
609
+
on:
610
+
schedule:
611
+
- cron: '0 3 * * 1' # Every Monday at 03:00 UTC
612
+
workflow_dispatch: # Allow manual trigger
613
+
614
+
jobs:
615
+
verify:
616
+
runs-on: ubuntu-latest
617
+
```
618
+
619
+
Stale pipelines break silently: secrets expire, base images get security patches, dependency resolution drifts. A weekly run catches this **before** it blocks a real release.
620
+
621
+
---
622
+
623
+
536
624
## Best Practice 1: Always Set a Job Timeout
537
625
538
626
Hanging Testcontainers or infinite loops block CI slots for hours without a timeout:
@@ -220,7 +212,7 @@ class ApplicationContextRunnerTest {
220
212
}
221
213
```
222
214
223
-
**Runs in milliseconds**— ideal for testing `@ConditionalOnProperty`, `@ConditionalOnClass`, `@ConditionalOnMissingBean`.
215
+
**Runs in milliseconds**- ideal for testing `@ConditionalOnProperty`, `@ConditionalOnClass`, `@ConditionalOnMissingBean`.
224
216
225
217
---
226
218
@@ -253,7 +245,7 @@ class ApplicationContextRunnerTest {
253
245
254
246
---
255
247
256
-
## ArchUnit — Code Examples
248
+
## ArchUnit - Code Examples
257
249
258
250
```java
259
251
@AnalyzeClasses(
@@ -535,7 +527,7 @@ log.info("Book created");
535
527
**Good observability checklist:**
536
528
- Structured JSON logs (Logback + `logstash-logback-encoder`) shipped to a central store
537
529
- Dashboards scoped to **error rate**, **p99 latency**, and **business KPIs** - not CPU graphs
538
-
- Runbooks linked directly from alert notifications
530
+
-[Runbooks](https://github.com/stratospheric-dev/stratospheric/tree/main/docs/runbooks) linked directly from alert notifications
539
531
540
532
---
541
533
@@ -556,13 +548,6 @@ commit → CI (tests pass) → build image → push to registry
556
548
557
549
---
558
550
559
-
**Rollback triggers to Monitor**
560
-
- Health check endpoint (`/actuator/health`) returns non-200 for > 60 s after deploy
561
-
- Error rate spikes above baseline within the first 5 minutes
562
-
- P99 latency exceeds SLO threshold post-deploy
563
-
564
-
---
565
-
566
551
## Blue/Green & A/B Deployments
567
552
568
553
**Blue/green** eliminates downtime and provides instant rollback: run two identical environments, flip the load balancer, keep the old environment warm.
- Get the complementary **Testing Spring Boot Applications Demystified** for free
724
+
725
+
- 120+ Pages with practical hands-on advice to ship code with confidence
726
+
727
+
- Get the eBook by joining our [newsletter](https://rieckpil.de/free-spring-boot-testing-book/) and receive further Spring Boot testing-related tips & tricks
0 commit comments