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

feat: support databend module #2779

Merged
merged 31 commits into from
Sep 20, 2024

Conversation

hantmac
Copy link
Contributor

@hantmac hantmac commented Sep 13, 2024

What does this PR do?

Support new module: databend

@hantmac hantmac requested a review from a team as a code owner September 13, 2024 03:25
Copy link

netlify bot commented Sep 13, 2024

Deploy Preview for testcontainers-go ready!

Name Link
🔨 Latest commit 7a24c55
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-go/deploys/66eccf0ee96ad1000832bc3d
😎 Deploy Preview https://deploy-preview-2779--testcontainers-go.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@mdelapenya mdelapenya left a comment

Choose a reason for hiding this comment

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

@hantmac thanks for adding this new module, much appreciated! The go code looks good, although we need to add all the metadata for the module to be included in the CI and in the docs.

Could you please run the module generator code for it? https://golang.testcontainers.org/modules/#creating-a-new-module

Thanks!

@mdelapenya
Copy link
Member

@hantmac I went ahead and added the scaffolding. Could you please enrich the docs with the new functional options so that users find them in our docs site 🙏 ?

Thanks in advance

@hantmac hantmac marked this pull request as draft September 13, 2024 12:24
@hantmac
Copy link
Contributor Author

hantmac commented Sep 13, 2024

@hantmac I went ahead and added the scaffolding. Could you please enrich the docs with the new functional options so that users find them in our docs site 🙏 ?

Thanks in advance

HI @mdelapenya , would you like to explain what is new functional options or where should I found it?

@hantmac hantmac marked this pull request as ready for review September 13, 2024 12:54
@hantmac
Copy link
Contributor Author

hantmac commented Sep 13, 2024

@mdelapenya HI bro, I saw you have add the docs and some CI workflow information, thanks very much! Is there some other things I need to do?

@hantmac hantmac requested a review from mdelapenya September 13, 2024 15:43
@mdelapenya mdelapenya self-assigned this Sep 13, 2024
@mdelapenya mdelapenya added the enhancement New feature or request label Sep 13, 2024
Copy link
Collaborator

@stevenh stevenh left a comment

Choose a reason for hiding this comment

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

Thanks for working on this, a few bugs to fix and a few questions, where I'd like some clarification.

modules/databend/databend.go Outdated Show resolved Hide resolved
modules/databend/databend.go Outdated Show resolved Hide resolved
modules/databend/databend.go Outdated Show resolved Hide resolved
modules/databend/databend.go Outdated Show resolved Hide resolved
modules/databend/databend.go Show resolved Hide resolved
modules/databend/databend_test.go Outdated Show resolved Hide resolved
modules/databend/examples_test.go Show resolved Hide resolved
modules/databend/examples_test.go Show resolved Hide resolved
modulegen/_template/ci.yml.tmpl Outdated Show resolved Hide resolved
docs/modules/databend.md Outdated Show resolved Hide resolved
@hantmac hantmac force-pushed the feat/support-databend-module branch from 497371c to 1a09c9a Compare September 14, 2024 01:33
Copy link
Member

@mdelapenya mdelapenya left a comment

Choose a reason for hiding this comment

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

We are close 😊 Just a few comments from my side plus Steven's.

Thanks for your patience during the review 🙏

}

// WithDatabase sets the name of the database to use.
func WithDatabase(database string) DatabendOption {
Copy link
Member

Choose a reason for hiding this comment

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

If the user pass this option, where does the Run function applies it to the container? See https://github.com/testcontainers/testcontainers-go/pull/2779/files#diff-05e51be59eadcbdc57a90dccc140946369a930b7bec7e9e987096ebed8beb9beR78 where the default db name is used.

Copy link
Member

Choose a reason for hiding this comment

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

We also need to add it to the docs site.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The db name will add to DSN when call ConnectionString, so that user can use the db.

Copy link
Collaborator

Choose a reason for hiding this comment

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

To confirm my understanding QUERY_DEFAULT_USER and QUERY_DEFAULT_PASSWORD configure the container at startup, which are then also used along side the database setting to allow ConnectionString to return the details for the client to connect to. There is no needed for default DB because the container doesn't need one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The container doesn't need default DB ENV, but the connection dsn need a default one.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Does that mean a hardcoded DB is always created?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, the default dababase exists when Databend start.

Copy link
Member

@mdelapenya mdelapenya Sep 18, 2024

Choose a reason for hiding this comment

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

So I think the WithDatabase function maybe not suitable for Databend?

@hantmac then, I'd remove the withDatabase support and add it in a follow up: adding the option and creating the new database using the commands you posted above, as part of the container lifecycle hooks (postStarts) in order to create that database. Wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mdelapenya I agree with you.

Copy link
Member

Choose a reason for hiding this comment

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

@hantmac perfect then. Let's remove it to make progress and merge this new module 🚀 , and postpone the work for the database support on a new iteration.

Thank you for all this hard work during the review 🙇

modules/databend/examples_test.go Outdated Show resolved Hide resolved
modules/databend/examples_test.go Show resolved Hide resolved
modules/databend/examples_test.go Outdated Show resolved Hide resolved
modules/databend/databend.go Show resolved Hide resolved
modules/databend/databend.go Show resolved Hide resolved
Copy link
Collaborator

@stevenh stevenh left a comment

Choose a reason for hiding this comment

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

Just need the imports fixing into the correct blocks as identified by the linter

@hantmac
Copy link
Contributor Author

hantmac commented Sep 17, 2024

Just need the imports fixing into the correct blocks as identified by the linter

Thanks! @stevenh , fixed the ci lint.

Copy link
Member

@mdelapenya mdelapenya left a comment

Choose a reason for hiding this comment

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

@hantmac let's remove all references to the WithDatabase, and once there. I think we are good to go.

@hantmac
Copy link
Contributor Author

hantmac commented Sep 19, 2024

@hantmac let's remove all references to the WithDatabase, and once there. I think we are good to go.

@mdelapenya Have removed the references to the WithDatabase, thanks for your patience.

@hantmac
Copy link
Contributor Author

hantmac commented Sep 20, 2024

@mdelapenya It's strange the mssql CI test failed. q.q

Copy link
Member

@mdelapenya mdelapenya left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for your hard work adding this new module. Very useful!

@mdelapenya
Copy link
Member

@mdelapenya It's strange the mssql CI test failed. q.q

The MSSQL failures have been resolved in #2786

@mdelapenya mdelapenya merged commit c1bb0bb into testcontainers:main Sep 20, 2024
114 checks passed
mdelapenya added a commit to mdelapenya/testcontainers-go that referenced this pull request Sep 20, 2024
* main:
  feat: support databend module (testcontainers#2779)
  chore: golangci-lint 1.61.0 (testcontainers#2787)
@hantmac
Copy link
Contributor Author

hantmac commented Sep 20, 2024

@mdelapenya Thanks for your help! BTW, I add the testcontainer-rs module in this pr testcontainers/testcontainers-rs-modules-community#207, is there anybody who can help to review it?

@mdelapenya
Copy link
Member

@hantmac could you please add this module to the modules catalog? https://testcontainers.com/modules/?language=go

There are instructions in this repo to elaborate the PR.

Regarding the Rust module, let me ping the community team on Slack

@hantmac
Copy link
Contributor Author

hantmac commented Sep 20, 2024

@hantmac could you please add this module to the modules catalog? https://testcontainers.com/modules/?language=go

There are instructions in this repo to elaborate the PR.

Regarding the Rust module, let me ping the community team on Slack

@mdelapenya Of course, I will add it.

That's greate! Thank you!

mdelapenya added a commit that referenced this pull request Sep 20, 2024
* main:
  feat: support databend module (#2779)
  chore: golangci-lint 1.61.0 (#2787)
  fix(mssql): bump Docker image version (#2786)
  fix: handle 127 error code for podman compatibility (#2778)
  fix: do not override ImageBuildOptions.Labels when building from a Dockerfile (#2775)
  feat(mongodb): Wait for mongodb module with a replicaset to finish (#2777)
  fix(postgres): Apply default snapshot name if no name specified (#2783)
@hantmac
Copy link
Contributor Author

hantmac commented Sep 21, 2024

There are instructions in this repo to elaborate the PR.

@mdelapenya Hi bro, I add the module to the modules catalog in this pr testcontainers/community-module-registry#75

mdelapenya added a commit to mdelapenya/testcontainers-go that referenced this pull request Sep 23, 2024
* main:
  chore: use a much smaller image for testing (testcontainers#2795)
  fix: parallel containers clean race (testcontainers#2790)
  fix(registry): wait for (testcontainers#2793)
  fix: container timeout test (testcontainers#2792)
  docs: document redpanda options (testcontainers#2789)
  feat: support databend module (testcontainers#2779)
  chore: golangci-lint 1.61.0 (testcontainers#2787)
  fix(mssql): bump Docker image version (testcontainers#2786)
  fix: handle 127 error code for podman compatibility (testcontainers#2778)
  fix: do not override ImageBuildOptions.Labels when building from a Dockerfile (testcontainers#2775)
  feat(mongodb): Wait for mongodb module with a replicaset to finish (testcontainers#2777)
  fix(postgres): Apply default snapshot name if no name specified (testcontainers#2783)
  fix: resource clean up for tests and examples (testcontainers#2738)
  ci: add generate for mocks (testcontainers#2774)
  fix: docker config error handling when config file does not exist (testcontainers#2772)
mdelapenya added a commit to mdelapenya/testcontainers-go that referenced this pull request Sep 23, 2024
* main:
  chore: use a much smaller image for testing (testcontainers#2795)
  fix: parallel containers clean race (testcontainers#2790)
  fix(registry): wait for (testcontainers#2793)
  fix: container timeout test (testcontainers#2792)
  docs: document redpanda options (testcontainers#2789)
  feat: support databend module (testcontainers#2779)
  chore: golangci-lint 1.61.0 (testcontainers#2787)
  fix(mssql): bump Docker image version (testcontainers#2786)
  fix: handle 127 error code for podman compatibility (testcontainers#2778)
  fix: do not override ImageBuildOptions.Labels when building from a Dockerfile (testcontainers#2775)
  feat(mongodb): Wait for mongodb module with a replicaset to finish (testcontainers#2777)
  fix(postgres): Apply default snapshot name if no name specified (testcontainers#2783)
  fix: resource clean up for tests and examples (testcontainers#2738)
mdelapenya added a commit that referenced this pull request Sep 26, 2024
* main: (29 commits)
  fix: template for code generation (#2800)
  fix: update module path (#2797)
  fix: container logging deadlocks (#2791)
  chore: use a much smaller image for testing (#2795)
  fix: parallel containers clean race (#2790)
  fix(registry): wait for (#2793)
  fix: container timeout test (#2792)
  docs: document redpanda options (#2789)
  feat: support databend module (#2779)
  chore: golangci-lint 1.61.0 (#2787)
  fix(mssql): bump Docker image version (#2786)
  fix: handle 127 error code for podman compatibility (#2778)
  fix: do not override ImageBuildOptions.Labels when building from a Dockerfile (#2775)
  feat(mongodb): Wait for mongodb module with a replicaset to finish (#2777)
  fix(postgres): Apply default snapshot name if no name specified (#2783)
  fix: resource clean up for tests and examples (#2738)
  ci: add generate for mocks (#2774)
  fix: docker config error handling when config file does not exist (#2772)
  docs: refine heading badges in README (#2770)
  feat(wait): for file (#2731)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants