Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GCloud module for Google Cloud Datastore, Firestore, PubSub, and Spanner emulators #2690

Merged
merged 24 commits into from
Oct 13, 2020

Conversation

eddumelendez
Copy link
Member

  • Add support to perform additional commands in the container
  • Add docs
  • Add gcloud module

@eddumelendez eddumelendez changed the title gcloud Add gcloud module May 9, 2020
@eddumelendez
Copy link
Member Author

It is pending to polish the pubsub test 🙈

return self();
}

private static ImageFromDockerfile buildImage(String image, String mainCmd, String[] prerequisiteCmds) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it really need to be an image? Can't we just use the command for it, since the image is not cached anyways?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the beginning I was not able to run it using command but that led me to know more about testcontainers. Now, I did it but had to set up a startupTimeout.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure about this? 😄
It looks like these setup steps will require a non-trivial amount of time to execute - perhaps even the majority of the startup time.

Would it be worth trying to get more attention on GoogleCloudPlatform/cloud-sdk-docker#202 so that we can avoid having these setup steps entirely?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I missed that we install Java and other things... Yeah, I believe we need to wait for these images :(

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs/modules/gcloud.md Outdated Show resolved Hide resolved
@saturnism
Copy link
Contributor

quick ping on this to see if there are any more work needed, happy to help

@eddumelendez
Copy link
Member Author

@saturnism currently, one of the things is the issue GoogleCloudPlatform/cloud-sdk-docker#202 in order to get images for the rest of the emulators. Also, I would appreciate your feedback in the tests. Thanks!

@saturnism
Copy link
Contributor

Will it be possible for the first iteration to use the non-alpine image that has emulators pre-installed? e.g., google/cloud-sdk:292.0.0 (and being able to specify version would be great!

@eddumelendez
Copy link
Member Author

for the first version, it make sense for me to use that image with components pre-installed. if everyone agree I can work on the changes.

@eddumelendez
Copy link
Member Author

@saturnism I was working on the changes but still using image google/cloud-sdk:304.0.0-debian_component_based we will need to install jdk in order to run emulators 😢

@saturnism
Copy link
Contributor

@eddumelendez can we use gcr.io/google.com/cloudsdktool/cloud-sdk:305.0.0? it's a larger image but should have the emulators.

however, it seems like firestore and spanner ones are not installed in this.
GoogleCloudPlatform/cloud-sdk-docker#217

@saturnism
Copy link
Contributor

@eddumelendez
Copy link
Member Author

eddumelendez commented Aug 16, 2020

@saturnism currently, I am using google/cloud-sdk:305.0.0 and it is working for datastore and pubsub. Regarding to spanner, in the cloud sdk use docker so would be a DinD approach. But, since the image in already available gcr.io/cloud-spanner-emulator/emulator:1.0.0 I am using it directly, or the PR you already sent will not use docker?. I will wait for firestore to be added so I will run my tests again and update the PR.

Have the feeling that we are close 😃

@saturnism
Copy link
Contributor

a quick update, the pr to have additional emulators has been merged, and it's likely it'll be released tomorrow under the 306 version tag. will keep you updated! i'm excited to see a closure on this soon :)

@eddumelendez
Copy link
Member Author

saw the merge notification. So excited too! I will be updating the PR tomorrow night and then ask for review

@eddumelendez
Copy link
Member Author

very glad to let you know that now that all components are installed in the image provided we can run everything successfully

@saturnism
Copy link
Contributor

this looks great! i feel this is almost ready to go?

public PubSubEmulatorContainer emulator = new PubSubEmulatorContainer();

@Test
public void testSimple() throws IOException, ExecutionException, InterruptedException {
Copy link

@walles walles Aug 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to have a(nother) test that:

  1. Publishes a message with some trivial contents
  2. Pulls that message from a subscription to that topic
  3. Verifies that the trivial contents was received

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@walles thanks for the suggestions. I have added one more commit introducing that change. 👍🏽

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful! 🥇

@rnorth
Copy link
Member

rnorth commented Aug 29, 2020

Thanks! I'll try and have another look at this over the weekend.

For now there's a docs build failure, apparently due to an incorrect codeinclude path:

12:58:58 AM: FileNotFoundError: [Errno 2] No such file or directory: '/opt/build/repo/docs/modules/../../../modules/gcloud/src/test/java/org/testcontainers/containers/DatastoreEmulatorContainerTest.java'

If you want a quicker feedback loop to see/check the generated docs locally, please have a look at: https://www.testcontainers.org/contributing_docs/

@eddumelendez
Copy link
Member Author

@rnorth thanks! fixed the docs

@eddumelendez
Copy link
Member Author

@bsideup branch rebase with master and proper changes applied :)

Comment on lines +15 to +16
private static final int GRPC_PORT = 9010;
private static final int HTTP_PORT = 9020;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder, maybe these should be public constants so that they can be used by tests? If we did that, we could do so for the other container classes in this PR.

WDYT @bsideup, @kiview?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT about not exposing the constants, but getGrpcPort/getHttpPort methods?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking at some of the other modules, private static final seems like the norm/convention atm. would it make sense to follow up w/ an issue for the broader change to expose these across modules?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been persuaded by @bsideup - many of our other modules have some mechanism for getting the mapped ports, address or URL for the running container. It seems like we should do this here, instead of exposing constants, as it's fundamentally more useful for the user.

I'll take the action to do this, as we've asked @eddumelendez to do too much already. I'll raise a quick PR tonight, and will merge this PR now.

Copy link
Member

@rnorth rnorth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few pretty trivial comments from me; otherwise I think we should merge soon!

…astoreEmulatorContainerTest.java

Co-authored-by: Richard North <rich.north@gmail.com>
@rnorth
Copy link
Member

rnorth commented Oct 11, 2020

LGTM but I'll let @bsideup comment too.
Thanks for the PR and the very quick responses @eddumelendez!

@rnorth rnorth added this to the next milestone Oct 13, 2020
@rnorth rnorth changed the title Add gcloud module Add GCloud module for Google Cloud Datastore, Firestore, PubSub, and Spanner emulators Oct 13, 2020
@rnorth
Copy link
Member

rnorth commented Oct 13, 2020

Merging now - thanks once again for the contribution @eddumelendez!

@rnorth rnorth merged commit 0065801 into testcontainers:master Oct 13, 2020
bsideup added a commit that referenced this pull request Feb 6, 2021
* Simplify `KafkaContainerCluster#start`

* When an image version is not specified, use `latest` as the default tag (#3313)

* Add workflow for Update Gradle Wrapper Action. (#3297)

Co-authored-by: Richard North <rich.north@gmail.com>

* Always continue on error for examples CI (#3339)

* Bump snakeyaml from 1.25 to 1.27 in /core (#3252)

Bumps [snakeyaml](https://bitbucket.org/asomov/snakeyaml) from 1.25 to 1.27.
- [Commits](https://bitbucket.org/asomov/snakeyaml/branches/compare/snakeyaml-1.27..snakeyaml-1.25)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump lombok from 1.18.12 to 1.18.14 in /examples (#3322)

Bumps [lombok](https://github.com/rzwitserloot/lombok) from 1.18.12 to 1.18.14.
- [Release notes](https://github.com/rzwitserloot/lombok/releases)
- [Changelog](https://github.com/rzwitserloot/lombok/blob/master/doc/changelog.markdown)
- [Commits](projectlombok/lombok@v1.18.12...v1.18.14)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump r2dbc-mariadb from 0.8.3-beta1 to 0.8.4-rc in /modules/mariadb (#3300)

Bumps [r2dbc-mariadb](https://github.com/mariadb-corporation/mariadb-connector-r2dbc) from 0.8.3-beta1 to 0.8.4-rc.
- [Release notes](https://github.com/mariadb-corporation/mariadb-connector-r2dbc/releases)
- [Changelog](https://github.com/mariadb-corporation/mariadb-connector-r2dbc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mariadb-corporation/mariadb-connector-r2dbc/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump testng from 7.2.0 to 7.3.0 in /examples (#3068)

Bumps [testng](https://github.com/cbeust/testng) from 7.2.0 to 7.3.0.
- [Release notes](https://github.com/cbeust/testng/releases)
- [Changelog](https://github.com/cbeust/testng/blob/master/CHANGES.txt)
- [Commits](https://github.com/cbeust/testng/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump assertj-core from 3.17.1 to 3.17.2 in /core (#3251)

Bumps [assertj-core](https://github.com/joel-costigliola/assertj-core) from 3.17.1 to 3.17.2.
- [Release notes](https://github.com/joel-costigliola/assertj-core/releases)
- [Commits](assertj/assertj@assertj-core-3.17.1...assertj-core-3.17.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump aws-java-sdk-dynamodb from 1.11.865 to 1.11.880 in /modules/dynalite (#3332)

Bumps [aws-java-sdk-dynamodb](https://github.com/aws/aws-sdk-java) from 1.11.865 to 1.11.880.
- [Release notes](https://github.com/aws/aws-sdk-java/releases)
- [Changelog](https://github.com/aws/aws-sdk-java/blob/master/CHANGELOG.md)
- [Commits](aws/aws-sdk-java@1.11.865...1.11.880)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump mockito-core from 3.5.11 to 3.5.13 in /core (#3275)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump elasticsearch-rest-client from 7.9.1 to 7.9.2 in /modules/elasticsearch (#3276)

Bumps [elasticsearch-rest-client](https://github.com/elastic/elasticsearch) from 7.9.1 to 7.9.2.
- [Release notes](https://github.com/elastic/elasticsearch/releases)
- [Commits](elastic/elasticsearch@v7.9.1...v7.9.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Increase memory limits used in example (#3340)

For improved test stability

* Bump mockito-core from 3.5.11 to 3.5.13 in /modules/junit-jupiter (#3283)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Richard North <rich.north@gmail.com>

* Bump tomcat-jdbc from 9.0.37 to 9.0.39 in /modules/jdbc-test (#3338)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Richard North <rich.north@gmail.com>

* Bump junit from 4.13 to 4.13.1 in /examples (#3328)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Richard North <rich.north@gmail.com>

* Bump mariadb-java-client from 2.6.2 to 2.7.0 in /modules/mariadb (#3278)

Bumps [mariadb-java-client](https://github.com/mariadb-corporation/mariadb-connector-j) from 2.6.2 to 2.7.0.
- [Release notes](https://github.com/mariadb-corporation/mariadb-connector-j/releases)
- [Changelog](https://github.com/mariadb-corporation/mariadb-connector-j/blob/master/CHANGELOG.md)
- [Commits](mariadb-corporation/mariadb-connector-j@2.6.2...2.7.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump solr-solrj from 8.6.2 to 8.6.3 in /examples (#3321)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Richard North <rich.north@gmail.com>

* Bump postgresql from 42.2.16 to 42.2.17 in /examples (#3323)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Richard North <rich.north@gmail.com>

* Bump postgresql from 42.2.16 to 42.2.17 in /modules/junit-jupiter (#3327)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Richard North <rich.north@gmail.com>

* Bump postgresql from 42.2.16 to 42.2.17 in /modules/spock (#3330)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Richard North <rich.north@gmail.com>

* Bump tomcat-jdbc from 9.0.37 to 9.0.39 in /modules/jdbc (#3333)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Richard North <rich.north@gmail.com>

* Bump postgresql from 42.2.16 to 42.2.17 in /modules/postgresql (#3334)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Richard North <rich.north@gmail.com>

* Bump aws-java-sdk-sqs from 1.11.860 to 1.11.880 in /modules/localstack (#3337)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Richard North <rich.north@gmail.com>

* Bump httpclient from 4.5.12 to 4.5.13 in /modules/junit-jupiter (#3326)

Bumps httpclient from 4.5.12 to 4.5.13.

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump httpclient from 4.5.12 to 4.5.13 in /modules/spock (#3329)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Richard North <rich.north@gmail.com>

* Bump cucumber-junit from 6.7.0 to 6.8.1 in /examples (#3325)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Richard North <rich.north@gmail.com>

* Bump org.springframework.boot from 2.3.3.RELEASE to 2.3.4.RELEASE in /examples (#3247)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Richard North <rich.north@gmail.com>

* Bump aws-java-sdk-s3 from 1.11.870 to 1.11.880 in /modules/localstack (#3336)

Bumps [aws-java-sdk-s3](https://github.com/aws/aws-sdk-java) from 1.11.870 to 1.11.880.
- [Release notes](https://github.com/aws/aws-sdk-java/releases)
- [Changelog](https://github.com/aws/aws-sdk-java/blob/master/CHANGELOG.md)
- [Commits](aws/aws-sdk-java@1.11.870...1.11.880)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump zt-exec from 1.10 to 1.12 in /core (#3253)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Richard North <rich.north@gmail.com>

* Bump s3 from 2.14.21 to 2.15.7 in /modules/localstack (#3335)

Bumps s3 from 2.14.21 to 2.15.7.

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump cucumber-java from 6.6.0 to 6.8.1 in /examples (#3324)

Bumps [cucumber-java](https://github.com/cucumber/cucumber-jvm) from 6.6.0 to 6.8.1.
- [Release notes](https://github.com/cucumber/cucumber-jvm/releases)
- [Changelog](https://github.com/cucumber/cucumber-jvm/blob/main/CHANGELOG.md)
- [Commits](cucumber/cucumber-jvm@v6.6.0...v6.8.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Remove GitHub Actions cache restore keys (#3342)

For more specific cache matching

* Allow users to specify a MongoDB database name (#2980)

Co-authored-by: Richard North <rich.north@gmail.com>

* Add GCloud module for Google Cloud Datastore, Firestore, PubSub, and Spanner emulators (#2690)

Co-authored-by: Richard North <rich.north@gmail.com>

* Use a lighter weight image for MultiplePortsExposedTest (#3343)

* Use a lighter weight image for MultiplePortsExposedTest

* Update helloworld container version

* docker-machine: get full remote daemon URL, to allow for use of custom daemon port (#2769) (#3237)

Co-authored-by: Vitalii Chura <c-vitalii.chura@hulu.com>

* Fix remote gradle cache 400 InvalidArgument error (#3346)

per hint given in https://www.digitalocean.com/community/questions/node-upload-file-to-s3-error-invalidargument-null

* Add gcloud endpoint accessors (#3344)

Co-authored-by: Sergei Egorov <bsideup@gmail.com>
Co-authored-by: Richard North <rich.north@gmail.com>
Co-authored-by: Cristian Greco <cristian@regolo.cc>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: silaev <silaev256@gmail.com>
Co-authored-by: Eddú Meléndez Gonzales <eddu.melendez@gmail.com>
Co-authored-by: vcvitaly <vcvitaly@yahoo.com>
Co-authored-by: Vitalii Chura <c-vitalii.chura@hulu.com>
@eddumelendez eddumelendez deleted the gcloud branch June 6, 2024 06:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants