Skip to content

refactor: consolidate integration test config into shared application.yaml#108

Open
nozoz wants to merge 4 commits into
mainfrom
refactor/integration-tests-configuration
Open

refactor: consolidate integration test config into shared application.yaml#108
nozoz wants to merge 4 commits into
mainfrom
refactor/integration-tests-configuration

Conversation

@nozoz
Copy link
Copy Markdown
Contributor

@nozoz nozoz commented May 16, 2026

Summary

  • build.gradle: replaced the .allDependencies.each { ... } workaround with the idiomatic configurations { integrationTestImplementation.extendsFrom testImplementation; integrationTestRuntimeOnly.extendsFrom testRuntimeOnly } pattern. The integrationTest suite now inherits the same test dependencies through standard Gradle wiring instead of a hand-rolled copy loop.
  • src/integrationTest/resources/application.yaml: lifted every property that was duplicated across integration tests (Kafka bootstrap, default replicas, fint.security.enabled=false, fint.org-id, fint.consumer.org-id, default fint.relation.base-url, auto-offset-reset, webflux base path, etc.) into a single shared base. Domain/package are intentionally not set here — each test must declare them.
  • Deleted application-utdanning-vurdering.yaml and application-utdanning-elev.yaml. Tests that used @ActiveProfiles for these have been switched to @TestPropertySource so the fint.consumer.domain + fint.consumer.package pair is always stated explicitly in the test class itself.
  • Every integration test's @TestPropertySource is now down to just domain + package + any truly per-test overrides (e.g. autorelation.enabled, consume-legacy-resource-topics, event.defaults.eviction, a non-default relation.base-url, a unique consumer group-id).
  • Net: ~280 lines of duplicated property strings removed.

Verified locally with ./gradlew integrationTest — BUILD SUCCESSFUL.

nozoz added 4 commits May 7, 2026 09:52
* feat: kill service on Kafka authorization errors

Wrap each consumer's error handler so a TopicAuthorizationException
(or any other AuthorizationException) raised from the consumer poll
loop hard-halts the JVM, letting the orchestrator restart the pod
instead of letting the listener loop log the error indefinitely.

* refactor: shut down on Kafka auth failure via ConsumerStoppedEvent

Replace the per-consumer ShutdownOnFatalKafkaErrorHandler wrapper with a
single @eventlistener on Spring Kafka's ConsumerStoppedEvent (Reason.AUTH).
Spring Kafka already classifies fatal AuthorizationExceptions and stops the
container, so the cause-walking and per-consumer wiring were duplicating
framework behaviour.

Exit now goes through SpringApplication.exit() + exitProcess(1) so the
context closes cleanly, @PreDestroy runs, and log appenders flush. Switches
the exit code from 137 (conventionally 128 + SIGKILL, what k8s reports when
it kills the pod) to 1 to avoid misleading pod-termination dashboards.

* refactor: drop createLoggingErrorHandler helper

The helper was only introduced earlier in this branch to host the shutdown
wrapper. With shutdown moved to the ConsumerStoppedEvent listener, it adds
no value over calling errorHandlerFactory.createErrorHandler directly with
the configuration — restoring the call-site shape used on main.
….yaml

Replace the .allDependencies.each {} workaround in build.gradle with the
idiomatic configurations.extendsFrom pattern so the integrationTest suite
inherits testImplementation/testRuntimeOnly cleanly.

Move every property that was duplicated across integration tests (kafka
bootstrap, default replicas, security flag, org-id, default relation
base-url, auto-offset-reset) into src/integrationTest/resources/application.yaml.
Each integration test now only declares fint.consumer.domain +
fint.consumer.package and whatever truly per-test overrides it needs.

Drop application-utdanning-vurdering.yaml and application-utdanning-elev.yaml
profile files; tests that used @activeprofiles now use @TestPropertySource for
a single explicit place naming domain + package.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant