testcontainers-go icon indicating copy to clipboard operation
testcontainers-go copied to clipboard

[Modules]: add examples/modules on the most uses services/images

Open mdelapenya opened this issue 2 years ago • 16 comments
trafficstars

Proposal

Given there is a tool to generate the scaffolding for new examples as Go modules (https://golang.testcontainers.org/examples), let's use it to start adding examples.

We have elaborated the list below from Testcontainers for Java. If you're interested in adding any example, please comment here the module you want to work on (we'll add your username to next to it in the list), use the tool to generate the scaffolding for the module you are interested in, and send a PR. We'll link your PR here next to the item in the list.

Our recommendation is to visit the Java module and start porting its behavior and settings to the Go example module.

Modules

  • [ ] azure cosmosdb
  • [x] cassandra @anilsenay #1726
  • [x] clickhouse @anilsenay https://github.com/testcontainers/testcontainers-go/pull/1372
  • [x] cockroachdb @mdelapenya #618
  • [x] consul @bo-er https://github.com/testcontainers/testcontainers-go/pull/722 @Chris-AS1 https://github.com/testcontainers/testcontainers-go/pull/2194
  • [x] @alihanyalcin #932 https://github.com/testcontainers/testcontainers-go/pull/876
  • [ ] db2
  • [ ] dragonflydb
  • [ ] dynalite
  • [x] elasticsearch @mdelapenya https://github.com/testcontainers/testcontainers-go/pull/1574
  • [x] gcloud
    • [x] datastore @eddumelendez https://github.com/testcontainers/testcontainers-go/pull/638
    • [x] firestore @eddumelendez https://github.com/testcontainers/testcontainers-go/pull/637
    • [x] pubsub @eddumelendez https://github.com/testcontainers/testcontainers-go/pull/640
    • [x] spanner @eddumelendez https://github.com/testcontainers/testcontainers-go/pull/642
  • [ ] hivemq
  • [x] inbucket @jespino #2142
  • [x] influxdb
  • [x] k3s @mritunjaysharma394 #1194
  • [x] k6 @pablochacin https://github.com/testcontainers/testcontainers-go/pull/1721
  • [x] kafka @noctarius https://github.com/testcontainers/testcontainers-go/pull/1610
  • [x] localstack @mdelapenya #795
  • [x] mariadb @mdelapenya #1548
  • [x] minio @adoublef https://github.com/testcontainers/testcontainers-go/pull/2132
  • [x] mockserver @jespino https://github.com/testcontainers/testcontainers-go/pull/2085
  • [x] mongodb @ravilushqa #723 and #726
  • [x] mssqlserver @agosmou #1969
  • [x] mysql @mdelapenya #700 @eddumelendez #943
  • [x] nats @adoublef https://github.com/testcontainers/testcontainers-go/pull/1190 @mdelapenya https://github.com/testcontainers/testcontainers-go/pull/1559
  • [x] neo4j @fbiville #921
  • [x] nginx @mdelapenya #618
  • [x] openldap @jespino https://github.com/testcontainers/testcontainers-go/pull/2117
  • [ ] oracle-xe
  • [ ] orientdb
  • [x] postgresql @mdelapenya #674 https://github.com/testcontainers/testcontainers-go/pull/945
  • [ ] presto
  • [x] pulsar @mdelapenya #618
  • [ ] questdb
  • [x] rabbitmq @mdelapenya #1618 @Tingaev #1031
  • [x] redis @mdelapenya #618
  • [x] redpanda @weeco #1058
  • [ ] selenium
  • [ ] solr
  • [ ] tidb
  • [x] toxiproxy @eddumelendez https://github.com/testcontainers/testcontainers-go/pull/643
  • [ ] trino
  • [x] vault @alihanyalcin https://github.com/testcontainers/testcontainers-go/pull/942
  • [ ] yugabytedb

mdelapenya avatar Nov 23 '22 16:11 mdelapenya

@mdelapenya can I pick mongodb?

ravilushqa avatar Jan 04 '23 08:01 ravilushqa

@mdelapenya can I pick mongodb?

Please do it! 🙏

mdelapenya avatar Jan 04 '23 10:01 mdelapenya

Interested in tackling Neo4j :)

fbiville avatar Mar 07 '23 17:03 fbiville

Interested in tackling Neo4j :)

@fbiville Amazing! Please do it, and thanks for your support :)

I created the subtask for you: https://github.com/testcontainers/testcontainers-go/issues/921

mdelapenya avatar Mar 07 '23 17:03 mdelapenya

@mdelapenya can I pick RabbitMQ?

Tingaev avatar Mar 31 '23 07:03 Tingaev

@mdelapenya can I pick RabbitMQ?

@Tingaev please go for it! Do you want to create an example or a real Go module? We should probably communicate the difference in a clearer manner, but modules for designed as dependencies to be consumed by downstream project, and examples for simply demonstrations, copying the code snippets, which include private APIs. Whatever you prefer is welcome

mdelapenya avatar Apr 03 '23 09:04 mdelapenya

Do you want to create an example or a real Go module?

@mdelapenya I thought and decided to make a module instead of just an example I will close the PR with an example

Tingaev avatar Apr 03 '23 14:04 Tingaev

Do you want to create an example or a real Go module?

@mdelapenya I thought and decided to make a module instead of just an example I will close the PR with an example

@Tingaev please take a look at https://github.com/testcontainers/testcontainers-go/pull/1016/files#diff-bf2f2ea9f93d17fd1a016e2893c5b7fe7dae04263b1662c8e03926e4e728f495. In this PR we try to explain how to create it

mdelapenya avatar Apr 03 '23 14:04 mdelapenya

I would be keen to including a NATS example (possibly module in the future) what would be required to do so?

adoublef avatar Apr 08 '23 10:04 adoublef

@adoublef you can probably start with a NATS example similar to what we have in Testcontainers for Java, see this. If you know more about NATS and how Testcontainers can help then we are all ears to build a NATS module.

eddumelendez avatar Apr 10 '23 23:04 eddumelendez

@eddumelendez cool, I have been in the slack groups for a while & been learning how to use NATS personally so will be able to showcase a usage. I also know from the NATS slack group, a lot are using jetstream.

I could likely port this over as I have found myself being able to get this working on many small projects

EDIT: I have forked and created an example for NATS here would the next step in the process be to submit a PR? what would be recommended.

adoublef avatar Apr 11 '23 11:04 adoublef

@adoublef I'd suggest starting with an example is great for experimenting with a module, like an incubation stage. Once you are happy with it, you could convert it into a real module, as described in https://golang.testcontainers.org/modules

You could use the code generation tool to bootstrap the scaffolding, and/or migrate the existing example following this:

  • File structure: https://golang.testcontainers.org/modules/#interested-in-converting-an-example-into-a-module
  • Types and exposed functions/methods: https://golang.testcontainers.org/modules/#adding-types-and-methods-to-the-module

Please consider that the modules design is still in dev (see https://github.com/testcontainers/testcontainers-go/pull/1042) so it's evolving using proper, better abstractions in it.

mdelapenya avatar Apr 13 '23 08:04 mdelapenya

Hi @mdelapenya, I am interested for k3s, can i pick iit up :))

Thanks!

mritunjaysharma394 avatar May 12 '23 18:05 mritunjaysharma394

@mritunjaysharma394 be my guest and do it! There is a Java implementation you can follow (j terms of API), will post here a link to it as I'm AFK

mdelapenya avatar May 12 '23 18:05 mdelapenya

That was quick, thanks a lot @mdelapenya, I guess you meant this link right?

also, loving this blog by you already!

mritunjaysharma394 avatar May 12 '23 18:05 mritunjaysharma394

I wanted to request adding a minio module? I have a version that I use in a persoanl sdk where the API is near enough similar to what I'd find with the official modules.

Cc @mdelapenya

adoublef avatar Jan 21 '24 15:01 adoublef