my team and I are really keen to include Google Pub/Sub in our application as it will solve some coupling issues. The problem we are having is how to do local integration tests in conjunction the java appengine dev server.
What I've done so far:
I'm assuming I'm doing something wrong because:
From this I am pretty sure that the emulator is not being picked up by the dev server.
I also have some deeper questions regarding our testing strategy. Is local integration testing really feasible in this day and age with more and more services becoming bound to the cloud. Should we be focusing more on integration test suites running against cloud instances themselves? If so how would one ensure that developers have the confidence in their code before deploying to a cloud test environment, and wouldn't this increase the feedback loop significantly?
UPDATE
Using the Google Java API Client PubSub builder class I was able to inject a url (localhost:8010) from a local configuration which now allows me to successfully publish to the local emulator.
Pubsub client = new Pubsub.Builder(httpTransport, jsonFactory, initializer)
.setApplicationName(getProjectId())
.setRootUrl(rootUrl).build();
I forced the port used to simplify setup for the rest of my team rather than having to depend on a dynamically changing port.
gcloud beta emulators pubsub start --host-port localhost:8010
Now topic, subscription and messages are being created successfully on the emulator. Unfortunately I'm still not getting the messages pushed to the endpoints registered.
UPDATE 2
gcloud version 120.0.0 seems to improve things but I'm now getting the following error:
{
"code" : 400,
"message" : "Payload isn't valid for request.",
"status" : "INVALID_ARGUMENT"
}
Will the latest update of the gcloud utility the local pubsub server has been fixed. This issue resolved it: https://code.google.com/p/cloud-pubsub/issues/detail?id=41
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With