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: add yugabytedb module #2825

Merged
merged 23 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
7436768
feat: add yugabytedb module
henripqt Oct 14, 2024
6f9a7ef
Merge branch 'main' into feat/add-yugabytedb-module
henripqt Oct 15, 2024
07674f5
fix: documentation links
henripqt Oct 15, 2024
084cde9
fix: codeinclude target
henripqt Oct 15, 2024
83a407f
feat: add test example for custom methods
henripqt Oct 15, 2024
6b09e71
Update modules/yugabytedb/yugabytedb_test.go
henripqt Oct 15, 2024
a51e4dd
Update modules/yugabytedb/yugabytedb.go
henripqt Oct 15, 2024
13cac89
Update modules/yugabytedb/yugabytedb_test.go
henripqt Oct 15, 2024
cad9e6a
fix: attended review issues
henripqt Oct 15, 2024
139f4d9
Update modules/yugabytedb/examples_test.go
henripqt Oct 16, 2024
2644453
fix: cleanup and review adjustements
henripqt Oct 16, 2024
4dea5ea
fix: remove test in comments and renamed struct
henripqt Oct 16, 2024
c556bd9
feat: add documentation for options
henripqt Oct 17, 2024
dcd9146
Merge branch 'main' into feat/add-yugabytedb-module
henripqt Oct 17, 2024
29ce547
Update modules/yugabytedb/yugabytedb_test.go
henripqt Oct 17, 2024
cb34dee
Update modules/yugabytedb/yugabytedb_test.go
henripqt Oct 17, 2024
fc9fc9c
fix: add additional wait strategy for data constraint log
henripqt Oct 17, 2024
d9d7aef
fix: remove customer method for ycql config and update test code
henripqt Oct 17, 2024
cd26ece
chore: run mod tidy
mdelapenya Oct 18, 2024
661dfec
chore: rename testable example to fix lint
mdelapenya Oct 18, 2024
d253ff8
fix: wrong cluster addr in example test
henripqt Oct 18, 2024
f31f993
Merge branch 'main' into feat/add-yugabytedb-module
henripqt Oct 18, 2024
2d7a7c7
fix: update code snippet run example
mdelapenya Oct 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/modules/yugabytedb.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@ E.g. `Run(context.Background(), "yugabytedb/yugabyte")`.

{% include "../features/common_functional_options.md" %}

henripqt marked this conversation as resolved.
Show resolved Hide resolved
#### Initial Database

By default the yugabyteDB container will start with a database named `yugabyte` and the default credentials `yugabyte` and `yugabyte`.

If you need to set a different database, and its credentials, you can use the `WithDatabaseName(dbName string)`, `WithDatabaseUser(dbUser string)` and `WithDatabasePassword(dbPassword string)` options.
mdelapenya marked this conversation as resolved.
Show resolved Hide resolved

#### Initial Cluster Configuration

By default the yugabyteDB container will start with a cluster keyspace named `yugabyte` and the default credentials `yugabyte` and `yugabyte`.

If you need to set a different cluster keyspace, and its credentials, you can use the `WithKeyspace(keyspace string)`, `WithUser(user string)` and `WithPassword(password string)` options.

### Container Methods

The yugabyteDB container exposes the following methods:
Expand Down
12 changes: 6 additions & 6 deletions modules/yugabytedb/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ import (
)

// WithDatabaseName sets the initial database name for the yugabyteDB container.
func WithDatabaseName(ysqlDBName string) testcontainers.CustomizeRequestOption {
func WithDatabaseName(dbName string) testcontainers.CustomizeRequestOption {
return func(req *testcontainers.GenericContainerRequest) error {
req.Env[ysqlDatabaseNameEnv] = ysqlDBName
req.Env[ysqlDatabaseNameEnv] = dbName
return nil
}
}

// WithDatabaseUser sets the initial database user for the yugabyteDB container.
func WithDatabaseUser(ysqlDBUser string) testcontainers.CustomizeRequestOption {
func WithDatabaseUser(dbUser string) testcontainers.CustomizeRequestOption {
return func(req *testcontainers.GenericContainerRequest) error {
req.Env[ysqlDatabaseUserEnv] = ysqlDBUser
req.Env[ysqlDatabaseUserEnv] = dbUser
return nil
}
}

// WithDatabasePassword sets the initial database password for the yugabyteDB container.
func WithDatabasePassword(ysqlDBPassword string) testcontainers.CustomizeRequestOption {
func WithDatabasePassword(dbPassword string) testcontainers.CustomizeRequestOption {
return func(req *testcontainers.GenericContainerRequest) error {
req.Env[ysqlDatabasePasswordEnv] = ysqlDBPassword
req.Env[ysqlDatabasePasswordEnv] = dbPassword
return nil
}
}
Expand Down