Bypass Auth when using PubSubTemplate
BaptisteOrieuxDecathlon opened this issue · 0 comments
BaptisteOrieuxDecathlon commented
Hi :)
I'm using PubSubTemplate for my application.
I'm trying to use your docker image to simulate a pub/sub queue for my end-to-end tests.
Here's my config :
spring.cloud.gcp.pubsub.emulator-host: localhost:4443
spring.cloud.gcp.pubsub.publisher.enable-message-ordering: true
spring.cloud.gcp.core.enabled: false
gcs-emulator:
image: fsouza/fake-gcs-server:latest
ports:
- "4443:4443"
environment:
- CLOUDSDK_CORE_PROJECT=fake-project
- NO_AUTH=true
command: bash -c " \
gsutil mb -p trackbox-zgho gs://my-test-bucket && \
gcloud pubsub topics create my-topic && \
gcloud pubsub subscriptions create test-queue-sub --topic test-queue \
"
When I run my tests, I get the following error :
c.g.c.s.a.p.h.PubSubHealthIndicator : Failed to connect to Pub/Sub APIs. Check your credentials and verify you have proper access to the service.
2024-03-07T15:29:29.568759608Z java.util.concurrent.TimeoutException: null
2024-03-07T15:29:29.568764775Z at java.base/java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1960)
2024-03-07T15:29:29.568766525Z at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2095)
2024-03-07T15:29:29.568767983Z at com.google.cloud.spring.autoconfigure.pubsub.health.PubSubHealthIndicator.pullMessage(PubSubHealthIndicator.java:122)
2024-03-07T15:29:29.568789275Z at com.google.cloud.spring.autoconfigure.pubsub.health.PubSubHealthIndicator.doHealthCheck(PubSubHealthIndicator.java:100)
2024-03-07T15:29:29.568791900Z at com.google.cloud.spring.autoconfigure.pubsub.health.PubSubHealthIndicator.doHealthCheck(PubSubHealthIndicator.java:95)
2024-03-07T15:29:29.568793233Z at org.springframework.boot.actuate.health.AbstractHealthIndicator.health(AbstractHealthIndicator.java:82)
2024-03-07T15:29:29.568794525Z at org.springframework.boot.actuate.health.HealthIndicator.getHealth(HealthIndicator.java:37)
2024-03-07T15:29:29.568795775Z at org.springframework.boot.actuate.health.HealthEndpointWebExtension.getHealth(HealthEndpointWebExtension.java:94)
2024-03-07T15:29:29.568797025Z at org.springframework.boot.actuate.health.HealthEndpointWebExtension.getHealth(HealthEndpointWebExtension.java:47)
2024-03-07T15:29:29.568798275Z at org.springframework.boot.actuate.health.HealthEndpointSupport.getLoggedHealth(HealthEndpointSupport.java:172)
2024-03-07T15:29:29.568799567Z at org.springframework.boot.actuate.health.HealthEndpointSupport.getContribution(HealthEndpointSupport.java:145)
2024-03-07T15:29:29.568801233Z at org.springframework.boot.actuate.health.HealthEndpointSupport.getAggregateContribution(HealthEndpointSupport.java:156)
2024-03-07T15:29:29.568802525Z at org.springframework.boot.actuate.health.HealthEndpointSupport.getContribution(HealthEndpointSupport.java:141)
2024-03-07T15:29:29.568803775Z at org.springframework.boot.actuate.health.HealthEndpointSupport.getHealth(HealthEndpointSupport.java:110)
2024-03-07T15:29:29.568805025Z at org.springframework.boot.actuate.health.HealthEndpointSupport.getHealth(HealthEndpointSupport.java:81)
2024-03-07T15:29:29.568806233Z at org.springframework.boot.actuate.health.HealthEndpointWebExtension.health(HealthEndpointWebExtension.java:80)
2024-03-07T15:29:29.568811775Z at org.springframework.boot.actuate.health.HealthEndpointWebExtension.health(HealthEndpointWebExtension.java:69)
2024-03-07T15:29:29.568816358Z at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2024-03-07T15:29:29.568817567Z at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
2024-03-07T15:29:29.568818858Z at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2024-03-07T15:29:29.568820150Z at java.base/java.lang.reflect.Method.invoke(Method.java:568)
2024-03-07T15:29:29.568821358Z at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:281)
[...]
I was wondering if there as a way to connect a pubSubTemplate bean to your fake GCS isntance, without having any authentication ?
I didn't manage to make it work...
Thanks in advance :)