Skip to content
This repository has been archived by the owner on Sep 22, 2023. It is now read-only.

Example Spring project showing how to use GCP emulator in a test

Notifications You must be signed in to change notification settings

Mersive-Technologies/pubsub-emulator-demo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pubsub-emulator-demo

Example Spring project showing how to use launch GCP emulator and test spring GCP pubsub in a test.

Key points:

  • test-containers library is used to launch google-sdk docker container and start pubsub emulator inside it
  • Tests are overridden to hit emulator via src/test/resources/test.properties by setting spring.cloud.gcp.pubsub-emulator-host: localhost:8085 (default emulator port)
  • TestPubSubConfig is used to bring up pubsub emulator inside a docker container, create a topic and subscription in the emulator. This is using GCP SDK directly, not Spring pubsub, to create the resources.

Running locally

brew install maven
gcloud beta emulators pubsub env-init
gcloud beta emulators pubsub start --project=test
mvn test

About

Example Spring project showing how to use GCP emulator in a test

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%