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

chore: adopt testcontainers-go for Postgres, MySQL and MongoDB #1515

Merged
merged 74 commits into from
Mar 19, 2025

Conversation

mdelapenya
Copy link
Contributor

@mdelapenya mdelapenya commented Aug 29, 2024

What does this PR do?

It uses testcontainers-go in the integration tests for the given stores, refactoring the tests to always consume a new test store, backed by a Docker container.

This PR also bumps testcontainers-go from v0.33.0 to v0.35.0

Why is it important?

Reproducibility: any developer will be able to run the tests locally exactly equals as in the Github Actions.

Related issues

For reference, please check out previous work for Couchbase and Minio (#1508) and ClickHouse (#1506)

There is more ongoing work, as defined in #1507

Other concerns

I started updating MSSQL module, but the container's pid 1 crashes, so I'm going to postpone its addition, using a separate PR for that.

Summary by CodeRabbit

  • Tests
    • Enhanced containerized testing across storage modules to ensure each test runs in a fresh, isolated instance.
    • Improved resource cleanup and wait strategies, leading to more robust and reliable test executions.
    • Updated underlying service configurations and images to boost overall stability during testing.
    • Introduced new test functions and constants for better clarity and resource management.
    • Streamlined error handling and resource management in test cases for improved maintainability.

@mdelapenya mdelapenya requested a review from a team as a code owner August 29, 2024 12:47
@mdelapenya mdelapenya requested review from gaby, sixcolors, ReneWerner87 and efectn and removed request for a team August 29, 2024 12:47
Copy link
Contributor

coderabbitai bot commented Aug 29, 2024

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (7)
  • .github/workflows/benchmark.yml is excluded by !**/*.yml
  • .github/workflows/test-clickhouse.yml is excluded by !**/*.yml
  • .github/workflows/test-couchbase.yml is excluded by !**/*.yml
  • .github/workflows/test-minio.yml is excluded by !**/*.yml
  • .github/workflows/test-mongodb.yml is excluded by !**/*.yml
  • .github/workflows/test-mysql.yml is excluded by !**/*.yml
  • .github/workflows/test-postgres.yml is excluded by !**/*.yml

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This pull request refactors the test setups across multiple storage backends by replacing static initialization of test stores with dynamic instantiation using Testcontainers. The changes add new functions—primarily newTestStore (and in one case mustStartMySQL)—to create containerized database instances for PostgreSQL, MongoDB, MySQL, and others. Additional modifications include enhanced resource cleanup, wait strategies, updated image versions, and minor adjustments to error handling and assertions in various test files.

Changes

File(s) Change Summary
postgres/..._test.go, mongodb/..._test.go, mysql/..._test.go Introduced new functions (newTestStore and mustStartMySQL) for dynamic test store initialization using Testcontainers; added configuration constants and replaced static test store instances to ensure fresh containerized environments for each test.
clickhouse/..._test.go, couchbase/..._test.go, minio/..._test.go Enhanced test cases with container management improvements: added Testcontainers imports, cleanup calls (e.g., testcontainers.CleanupContainer), deferred closure of test stores, updated wait strategies, and, for ClickHouse, added a dedicated test verifying client closure.
neo4j/..._test.go, s3/init_test.go Modified the TestMain functions to include wait strategies ensuring container readiness—using port checks, log messages, and HTTP health checks—so that the respective services (Neo4j and MinIO) are fully operational before tests proceed.

Sequence Diagram(s)

sequenceDiagram
    participant T as Test Case
    participant N as newTestStore
    participant C as Testcontainers
    participant S as Storage Instance

    T->>N: Call newTestStore(t)
    N->>C: Request container startup
    C->>N: Signal container readiness (ports, health checks)
    N->>T: Return new Storage instance
    T->>S: Execute test operations
    S-->>T: Cleanup on test completion
Loading

Possibly related PRs

Suggested labels

🧹 Updates

Suggested reviewers

  • sixcolors
  • gaby
  • ReneWerner87
  • efectn

Poem

I’m a rabbit with a hop so keen,
Containers now rule every test scene.
Fresh stores spin up with a flick of code,
Bugs retreat down the winding road.
With cleanup and checks all shining bright,
I nibble on success deep into the night!
🐰✨


Note

🎁 Summarized by CodeRabbit Free

Your organization has reached its limit of developer seats under the Pro Plan. For new users, CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please add seats to your subscription by visiting https://app.coderabbit.ai/login.If you believe this is a mistake and have available seats, please assign one to the pull request author through the subscription management page using the link above.

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2f1c0cb and 2f5263e.

Files ignored due to path filters (8)
  • mongodb/go.mod is excluded by !**/*.mod
  • mongodb/go.sum is excluded by !**/*.sum, !**/*.sum
  • mssql/go.mod is excluded by !**/*.mod
  • mssql/go.sum is excluded by !**/*.sum, !**/*.sum
  • mysql/go.mod is excluded by !**/*.mod
  • mysql/go.sum is excluded by !**/*.sum, !**/*.sum
  • postgres/go.mod is excluded by !**/*.mod
  • postgres/go.sum is excluded by !**/*.sum, !**/*.sum
Files selected for processing (9)
  • .github/workflows/benchmark.yml (2 hunks)
  • .github/workflows/test-mongodb.yml (2 hunks)
  • .github/workflows/test-mssql.yml (2 hunks)
  • .github/workflows/test-mysql.yml (2 hunks)
  • .github/workflows/test-postgres.yml (2 hunks)
  • mongodb/mongodb_test.go (11 hunks)
  • mssql/mssql_test.go (12 hunks)
  • mysql/mysql_test.go (13 hunks)
  • postgres/postgres_test.go (12 hunks)
Additional comments not posted (32)
.github/workflows/test-mysql.yml (1)

30-31: LGTM!

The introduction of the TEST_MYSQL_IMAGE environment variable is a good practice to ensure consistency and reliability in the testing environment.

.github/workflows/test-mongodb.yml (2)

19-20: LGTM!

Updating the Go version matrix to include newer versions is a good practice to ensure compatibility and performance with the latest Go versions.


30-30: LGTM!

The introduction of the TEST_MONGODB_IMAGE environment variable is a good practice to ensure consistency and reliability in the testing environment.

.github/workflows/test-postgres.yml (1)

30-31: LGTM!

The introduction of the TEST_POSTGRES_IMAGE environment variable is a good practice to ensure consistency and reliability in the testing environment.

.github/workflows/test-mssql.yml (1)

30-31: LGTM!

The addition of the environment variable TEST_MSSQL_IMAGE is correct and aligns with the PR objective.

.github/workflows/benchmark.yml (4)

118-118: LGTM!

The addition of the environment variable TEST_MONGODB_IMAGE is correct and aligns with the PR objective.


119-119: LGTM!

The addition of the environment variable TEST_MSSQL_IMAGE is correct and aligns with the PR objective.


120-120: LGTM!

The addition of the environment variable TEST_MYSQL_IMAGE is correct and aligns with the PR objective.


121-121: LGTM!

The addition of the environment variable TEST_POSTGRES_IMAGE is correct and aligns with the PR objective.

mongodb/mongodb_test.go (10)

10-10: LGTM!

The import statement for testcontainers-go/modules/mongodb is correct and necessary for using the testcontainers-go library for MongoDB.


13-19: LGTM!

The constant block for MongoDB image and credentials is correctly defined and aligns with the PR objective.


21-44: LGTM!

The newTestStore function is correctly implemented and improves the isolation of tests by ensuring that each test starts with a fresh instance of the MongoDB store.


53-55: LGTM!

The modification of the Test_MongoDB_Set function to use newTestStore is correct and aligns with the PR objective.


66-68: LGTM!

The modification of the Test_MongoDB_Set_Override function to use newTestStore is correct and aligns with the PR objective.


82-84: LGTM!

The modification of the Test_MongoDB_Get function to use newTestStore is correct and aligns with the PR objective.


100-102: LGTM!

The modification of the Test_MongoDB_Set_Expiration function to use newTestStore is correct and aligns with the PR objective.


112-114: LGTM!

The modification of the Test_MongoDB_Get_Expired function to use newTestStore is correct and aligns with the PR objective.


121-123: LGTM!

The modification of the Test_MongoDB_Get_NotExist function to use newTestStore is correct and aligns with the PR objective.


135-137: LGTM!

The modification of the Test_MongoDB_Delete function to use newTestStore is correct and aligns with the PR objective.

mssql/mssql_test.go (4)

4-11: LGTM!

The import statements are correct and necessary for the functionality.


14-21: LGTM!

The constants improve configurability and readability.


23-51: LGTM!

The function is correctly implemented and ensures each test runs in isolation with a fresh database connection.


Line range hint 59-264: LGTM!

The updates ensure that each test retrieves its own instance of the storage, improving test isolation and reliability.

mysql/mysql_test.go (5)

4-11: LGTM!

The import statements are correct and necessary for the functionality.


14-21: LGTM!

The constants improve configurability and readability.


23-39: LGTM!

The function is correctly implemented and ensures each test runs in isolation with a fresh database connection.


41-57: LGTM!

The function is correctly implemented and ensures the MySQL container is properly configured and started.


Line range hint 59-294: LGTM!

The updates ensure that each test retrieves its own instance of the storage, improving test isolation and reliability.

postgres/postgres_test.go (4)

Line range hint 4-13: LGTM!

The import statements are correct and necessary for the functionality.


16-23: LGTM!

The constants improve configurability and readability.


25-56: LGTM!

The function is correctly implemented and ensures each test runs in isolation with a fresh database connection.


Line range hint 64-282: LGTM!

The updates ensure that each test retrieves its own instance of the storage, improving test isolation and reliability.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2f5263e and 689759c.

Files selected for processing (1)
  • .github/workflows/test-mongodb.yml (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/test-mongodb.yml

Copy link
Member

@gaby gaby left a comment

Choose a reason for hiding this comment

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

Small comment

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 689759c and de8f798.

Files ignored due to path filters (2)
  • mongodb/go.mod is excluded by !**/*.mod
  • postgres/go.mod is excluded by !**/*.mod
Files selected for processing (3)
  • .github/workflows/test-mssql.yml (2 hunks)
  • .github/workflows/test-mysql.yml (2 hunks)
  • .github/workflows/test-postgres.yml (2 hunks)
Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/test-mssql.yml
  • .github/workflows/test-postgres.yml
Additional comments not posted (4)
.github/workflows/test-mysql.yml (4)

19-19: LGTM!

The addition of Go version 1.22.x to the matrix is appropriate.


20-20: LGTM!

The addition of Go version 1.23.x to the matrix is appropriate.


30-30: LGTM!

Setting the TEST_MYSQL_IMAGE environment variable to docker.io/mysql:9 ensures consistency and reliability in the testing environment.


31-31: LGTM!

Running the tests with the specified MySQL image is appropriate.

@mdelapenya
Copy link
Contributor Author

For some reason, the memcache service is failing in the benchmark job. Any guess?

@ReneWerner87
Copy link
Member

sorry overlooked, that's really strange, I'll have to take a look at it in the next few days

@mdelapenya
Copy link
Contributor Author

@ReneWerner87 any update on the benchmark thing? 🙏 Once merge, I can send a new PR with more stores

@ReneWerner87
Copy link
Member

unfortunately haven't had time to look yet, will have a look on sunday and fix it then, but feel free to make pull requests for the other stores if you like

in this case we only have to apply the fix to the other PR

@ReneWerner87
Copy link
Member

ReneWerner87 commented Sep 15, 2024

@mdelapenya now the reason

you removed the other services

image

now the options from postgres for the health check belongs to memcached

image

but there is no postgres started

image

other question
do we have to change the golang versions in the test-*.yml's and go.mod files?
then we would cause a breaking change as in the previous PR request
#1508 (comment)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (1)
mysql/mysql_test.go (1)

137-152: ⚠️ Potential issue

Add expiration verification in Test_MYSQL_Set_Expiration.

The test sets expiration and waits but doesn't verify that the key has actually expired.

 func Test_MYSQL_Set_Expiration(t *testing.T) {
     var (
         key = "john"
         val = []byte("doe")
         exp = 1 * time.Second
     )
 
     testStore, err := newTestStore(t)
     require.NoError(t, err)
     defer testStore.Close()
 
     err = testStore.Set(key, val, exp)
     require.NoError(t, err)
 
     time.Sleep(1100 * time.Millisecond)
+
+    // Verify key has expired
+    result, err := testStore.Get(key)
+    require.NoError(t, err)
+    require.Zero(t, len(result), "Key should have expired")
 }
🧹 Nitpick comments (3)
mongodb/mongodb_test.go (1)

25-58: Consider adding retries for MongoDB connection.

While the wait strategy ensures the container is ready, MongoDB might need additional time to accept connections in some cases.

 func newTestStore(t testing.TB) (*Storage, error) {
     t.Helper()
 
     img := mongoDBImage
     if imgFromEnv := os.Getenv(mongoDBImageEnvVar); imgFromEnv != "" {
         img = imgFromEnv
     }
 
     ctx := context.Background()
+
+    // Add retry logic for MongoDB connection
+    var store *Storage
+    var err error
+    for i := 0; i < 3; i++ {
+        store, err = tryConnect(ctx, t, img)
+        if err == nil {
+            return store, nil
+        }
+        time.Sleep(time.Second)
+    }
+    return store, err
 }
+
+func tryConnect(ctx context.Context, t testing.TB, img string) (*Storage, error) {
     c, err := mongodb.Run(
         ctx, img, mongodb.WithUsername(mongoDBUser), mongodb.WithPassword(mongoDBPass),
         testcontainers.WithWaitStrategy(
             wait.ForAll(
                 wait.ForListeningPort(mongoDBPort),
                 wait.ForLog(mongoDBReadyLog),
             ),
         ),
     )
     testcontainers.CleanupContainer(t, c)
     if err != nil {
         return nil, err
     }
 
     conn, err := c.ConnectionString(ctx)
     if err != nil {
         return nil, err
     }
 
     return New(Config{
         ConnectionURI: conn,
         Reset:         true,
     }), nil
postgres/postgres_test.go (1)

34-40: Enhance wait strategy for more reliable container startup.

The current basic wait strategy might not be sufficient in all environments.

 c, err := postgres.Run(ctx, img,
     postgres.WithUsername(postgresUser),
     postgres.WithPassword(postgresPass),
     postgres.WithDatabase(postgresDatabase),
-    postgres.BasicWaitStrategies(),
+    testcontainers.WithWaitStrategy(
+        wait.ForAll(
+            wait.ForLog("database system is ready to accept connections").WithOccurrence(2),
+            wait.ForListeningPort("5432/tcp"),
+        ),
+    ),
 )
mysql/mysql_test.go (1)

51-61: Consider adding health check in wait strategy.

The current wait strategy checks for port and log, but a health check would provide stronger guarantees.

 c, err := mysql.Run(ctx, img,
     mysql.WithPassword(mysqlPass),
     mysql.WithUsername(mysqlUser),
     mysql.WithDatabase(mysqlDatabase),
     testcontainers.WithWaitStrategy(
         wait.ForListeningPort("3306/tcp"),
         wait.ForLog("port: 3306  MySQL Community Server"),
+        wait.ForSQL("3306/tcp", "mysql", func(port nat.Port) string {
+            return fmt.Sprintf("root:%s@(localhost:%s)/%s", mysqlPass, port.Port(), mysqlDatabase)
+        }).WithStartupTimeout(time.Second * 30),
     ),
 )
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0c2d884 and f2ff5e7.

📒 Files selected for processing (6)
  • clickhouse/clickhouse_test.go (5 hunks)
  • minio/minio_test.go (17 hunks)
  • mongodb/mongodb_test.go (10 hunks)
  • mysql/mysql_test.go (13 hunks)
  • neo4j/neo4j_test.go (2 hunks)
  • postgres/postgres_test.go (11 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • neo4j/neo4j_test.go
  • minio/minio_test.go
🧰 Additional context used
🧠 Learnings (1)
mysql/mysql_test.go (2)
Learnt from: mdelapenya
PR: gofiber/storage#1515
File: mysql/mysql_test.go:18-18
Timestamp: 2025-02-18T17:22:10.331Z
Learning: The `mysql:9` Docker image exists and is actively maintained, with regular updates on Docker Hub. The image was verified through Docker Hub's API and is suitable for testing purposes.
Learnt from: mdelapenya
PR: gofiber/storage#1515
File: mysql/mysql_test.go:18-18
Timestamp: 2025-02-18T17:22:10.331Z
Learning: The `mysql:9` Docker image exists and can be used for testing, although it represents a development version of MySQL. The image is available at docker.io/mysql:9.
🪛 GitHub Actions: Tests Clickhouse
clickhouse/clickhouse_test.go

[error] 170-170: Received unexpected error: [handshake] unexpected packet [72] from server in Test_Delete


[error] 192-192: Received unexpected error: [handshake] unexpected packet [72] from server in Test_Reset


[error] 214-214: Received unexpected error: [handshake] unexpected packet [72] from server in TestClose_ShouldReturn_NoError

⏰ Context from checks skipped due to timeout of 90000ms (14)
  • GitHub Check: compare (s3)
  • GitHub Check: compare (mongodb)
  • GitHub Check: compare (clickhouse)
  • GitHub Check: compare (minio)
  • GitHub Check: compare (mysql)
  • GitHub Check: compare (postgres)
  • GitHub Check: compare (neo4j)
  • GitHub Check: compare (couchbase)
  • GitHub Check: Tests (1.23.x)
  • GitHub Check: Tests (1.22.x)
  • GitHub Check: Tests (1.23.x)
  • GitHub Check: Tests (1.21.x)
  • GitHub Check: Tests (1.22.x)
  • GitHub Check: Tests (1.21.x)
🔇 Additional comments (1)
mongodb/mongodb_test.go (1)

15-23: LGTM! Well-structured constants.

The constants are well-organized and provide clear configuration for the MongoDB container setup.

Comment on lines +45 to +52
testcontainers.WithWaitStrategy(
wait.ForAll(
wait.ForListeningPort(clickhouseHttpPort),
wait.NewHTTPStrategy("/").WithPort(clickhouseHttpPort).WithStatusCodeMatcher(func(status int) bool {
return status == clickhouseSuccessCode
}),
),
),
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix handshake errors by adjusting wait strategy.

The current wait strategy is causing handshake errors in the pipeline. The HTTP check might complete before the native protocol port is ready.

 testcontainers.WithWaitStrategy(
     wait.ForAll(
         wait.ForListeningPort(clickhouseHttpPort),
-        wait.NewHTTPStrategy("/").WithPort(clickhouseHttpPort).WithStatusCodeMatcher(func(status int) bool {
-            return status == clickhouseSuccessCode
-        }),
+        wait.ForLog("Ready for connections").WithStartupTimeout(time.Second * 30),
+        wait.ForListeningPort("9000/tcp"),
     ),
 ),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
testcontainers.WithWaitStrategy(
wait.ForAll(
wait.ForListeningPort(clickhouseHttpPort),
wait.NewHTTPStrategy("/").WithPort(clickhouseHttpPort).WithStatusCodeMatcher(func(status int) bool {
return status == clickhouseSuccessCode
}),
),
),
testcontainers.WithWaitStrategy(
wait.ForAll(
wait.ForListeningPort(clickhouseHttpPort),
wait.ForLog("Ready for connections").WithStartupTimeout(time.Second * 30),
wait.ForListeningPort("9000/tcp"),
),
),

@mdelapenya
Copy link
Contributor Author

Hi again, sorry for taking that long for this PR, too many tasks on my plate 🤦

In any case, I improved the wait strategies in the modules in the project, which potential additions for the upstream modules in testcontainers-go. It's failing for couchbase because the pipeline takes more than the 120s that are defined in the GH workflow.

Is increasing that timeout an issue for you?

@gaby
Copy link
Member

gaby commented Feb 28, 2025

@mdelapenya Make it 300s (5mins)

@mdelapenya
Copy link
Contributor Author

In my Mac M1:

go test ./... -timeout 600s -benchmem -run=^$ -bench .
goos: darwin
goarch: arm64
pkg: github.com/gofiber/storage/couchbase/v2
cpu: Apple M1 Pro
Benchmark_Couchbase_Set-8                     32          35257534 ns/op           16723 B/op        250 allocs/op
Benchmark_Couchbase_Get-8                     37          31788931 ns/op            7061 B/op        128 allocs/op
Benchmark_Couchbase_SetAndDelete-8            14          72472684 ns/op           39245 B/op        549 allocs/op
PASS
ok      github.com/gofiber/storage/couchbase/v2 337.864s

* main:
  quickfix: update tests
  fix: uses existing table if exists
  Add migrate.md
  Update README.md
  Update README.md
  Update README.md
  Update README.md
  Update test-leveldb.yml
  Update README.md
  DBPath Converted to Path
  Small things fixed
  Update leveldb_test.go
  coderabbitai recommendations were evaluated and added
  leveldb_test update
  Update config_test.go
  workflow added
  leveldb support added
@mdelapenya
Copy link
Contributor Author

@gaby @ReneWerner87 this branch is now green!

It took time, but we finally made it. Major highlight here was a timeout for the couchbase benchmarks. I increased the timeout to 500s to bypass it. In general, all benchmarks take 1-2 minutes, but for some reason couchbase not.

I rebased the branch to cover the recent changes in the postgres module, so I think it's ready for start the review.

As always, please let me know anything you need here.

@gaby
Copy link
Member

gaby commented Mar 17, 2025

Will review today after work, thanks 💪

Copy link
Member

@gaby gaby left a comment

Choose a reason for hiding this comment

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

LGTM, minimal comments here and there

@mdelapenya mdelapenya requested a review from gaby March 18, 2025 13:00
Copy link
Member

@gaby gaby left a comment

Choose a reason for hiding this comment

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

👍 LGTM, this is phenomenal work!

@ReneWerner87 ReneWerner87 merged commit c1933ed into gofiber:main Mar 19, 2025
43 checks passed
@mdelapenya mdelapenya deleted the tc-go-adoption-2 branch March 19, 2025 08:56
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.

3 participants