Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/go_modules/modules/compose/github…
Browse files Browse the repository at this point in the history
….com/docker/compose/v2-2.24.3
  • Loading branch information
mdelapenya authored Jan 29, 2024
2 parents 08de6c4 + 7151628 commit 8948153
Show file tree
Hide file tree
Showing 93 changed files with 2,450 additions and 619 deletions.
28 changes: 21 additions & 7 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ updates:
day: sunday
open-pull-requests-limit: 3
rebase-strategy: disabled
- package-ecosystem: gomod
directory: /examples/cockroachdb
schedule:
interval: monthly
day: sunday
open-pull-requests-limit: 3
rebase-strategy: disabled
- package-ecosystem: gomod
directory: /examples/consul
schedule:
Expand Down Expand Up @@ -79,6 +72,13 @@ updates:
day: sunday
open-pull-requests-limit: 3
rebase-strategy: disabled
- package-ecosystem: gomod
directory: /modules/cockroachdb
schedule:
interval: monthly
day: sunday
open-pull-requests-limit: 3
rebase-strategy: disabled
- package-ecosystem: gomod
directory: /modules/compose
schedule:
Expand Down Expand Up @@ -107,6 +107,13 @@ updates:
day: sunday
open-pull-requests-limit: 3
rebase-strategy: disabled
- package-ecosystem: gomod
directory: /modules/inbucket
schedule:
interval: monthly
day: sunday
open-pull-requests-limit: 3
rebase-strategy: disabled
- package-ecosystem: gomod
directory: /modules/k3s
schedule:
Expand Down Expand Up @@ -191,6 +198,13 @@ updates:
day: sunday
open-pull-requests-limit: 3
rebase-strategy: disabled
- package-ecosystem: gomod
directory: /modules/openldap
schedule:
interval: monthly
day: sunday
open-pull-requests-limit: 3
rebase-strategy: disabled
- package-ecosystem: gomod
directory: /modules/postgres
schedule:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ jobs:
strategy:
matrix:
go-version: [1.20.x, 1.x]
platform: [ubuntu-latest, macos-latest]
module: [artemis, cassandra, clickhouse, compose, couchbase, elasticsearch, gcloud, k3s, k6, kafka, localstack, mariadb, minio, mockserver, mongodb, mssql, mysql, nats, neo4j, postgres, pulsar, rabbitmq, redis, redpanda, vault]
platform: [ubuntu-latest]
module: [artemis, cassandra, clickhouse, cockroachdb, compose, couchbase, elasticsearch, gcloud, inbucket, k3s, k6, kafka, localstack, mariadb, minio, mockserver, mongodb, mssql, mysql, nats, neo4j, openldap, postgres, pulsar, rabbitmq, redis, redpanda, vault]
exclude:
- go-version: 1.20.x
module: compose
Expand All @@ -124,7 +124,7 @@ jobs:
needs: test-modules
strategy:
matrix:
module: [cockroachdb, consul, nginx, toxiproxy]
module: [consul, nginx, toxiproxy]
uses: ./.github/workflows/ci-test-go.yml
with:
go-version: "1.20.x"
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ linters-settings:
- prefix(github.com/testcontainers)
testifylint:
disable:
- compares
- float-compare
- go-require
enable:
- bool-compare
- compares
- empty
- error-is-as
- error-nil
Expand Down
16 changes: 12 additions & 4 deletions .vscode/.testcontainers-go.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
"name": "testcontainers-go",
"path": "../"
},
{
"name": "example / cockroachdb",
"path": "../examples/cockroachdb"
},
{
"name": "example / consul",
"path": "../examples/consul"
Expand All @@ -33,6 +29,10 @@
"name": "module / clickhouse",
"path": "../modules/clickhouse"
},
{
"name": "module / cockroachdb",
"path": "../modules/cockroachdb"
},
{
"name": "module / compose",
"path": "../modules/compose"
Expand All @@ -49,6 +49,10 @@
"name": "module / gcloud",
"path": "../modules/gcloud"
},
{
"name": "module / inbucket",
"path": "../modules/inbucket"
},
{
"name": "module / k3s",
"path": "../modules/k3s"
Expand Down Expand Up @@ -97,6 +101,10 @@
"name": "module / neo4j",
"path": "../modules/neo4j"
},
{
"name": "module / openldap",
"path": "../modules/openldap"
},
{
"name": "module / postgres",
"path": "../modules/postgres"
Expand Down
4 changes: 2 additions & 2 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ git add modules/**/go.*
git commit -m chore: use new version (v0.20.1) in modules and examples
git tag v0.20.1
git tag examples/bigtable/v0.20.1
git tag examples/cockroachdb/v0.20.1
git tag examples/consul/v0.20.1
git tag examples/datastore/v0.20.1
git tag examples/firestore/v0.20.1
Expand All @@ -159,6 +158,7 @@ git tag examples/nginx/v0.20.1
git tag examples/pubsub/v0.20.1
git tag examples/spanner/v0.20.1
git tag examples/toxiproxy/v0.20.1
git tag modules/cockroachdb/v0.20.1
git tag modules/compose/v0.20.1
git tag modules/couchbase/v0.20.1
git tag modules/localstack/v0.20.1
Expand All @@ -178,7 +178,6 @@ git commit -m chore: prepare for next minor development cycle (0.21.0)
git push origin main --tags
curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/@v/v0.20.1.info
curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/examples/bigtable/@v/v0.20.1.info
curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/examples/cockroachdb/@v/v0.20.1.info
curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/examples/consul/@v/v0.20.1.info
curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/examples/datastore/@v/v0.20.1.info
curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/examples/firestore/@v/v0.20.1.info
Expand All @@ -187,6 +186,7 @@ curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/exampl
curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/examples/pubsub/@v/v0.20.1.info
curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/examples/spanner/@v/v0.20.1.info
curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/examples/toxiproxy/@v/v0.20.1.info
curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/modules/cockroachdb/@v/v0.20.1.info
curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/modules/compose/@v/v0.20.1.info
curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/modules/couchbase/@v/v0.20.1.info
curl https://proxy.golang.org/github.com/testcontainers/testcontainers-go/modules/localstack/@v/v0.20.1.info
Expand Down
2 changes: 1 addition & 1 deletion docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1537,7 +1537,7 @@ func TestDockerCreateContainerWithDirs(t *testing.T) {
})
terminateContainerOnEnd(t, ctx, nginxC)

require.True(t, (err != nil) == tc.hasError)
require.Equal(t, (err != nil), tc.hasError)
if err == nil {
dir := tc.dir

Expand Down
9 changes: 0 additions & 9 deletions docs/examples/cockroachdb.md

This file was deleted.

81 changes: 81 additions & 0 deletions docs/modules/cockroachdb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# CockroachDB

Not available until the next release of testcontainers-go <a href="https://github.com/testcontainers/testcontainers-go"><span class="tc-version">:material-tag: main</span></a>

## Introduction

The Testcontainers module for CockroachDB.

## Adding this module to your project dependencies

Please run the following command to add the CockroachDB module to your Go dependencies:

```
go get github.com/testcontainers/testcontainers-go/modules/cockroachdb
```

## Usage example

<!--codeinclude-->
[Creating a CockroachDB container](../../modules/cockroachdb/examples_test.go) inside_block:runCockroachDBContainer
<!--/codeinclude-->

## Module reference

The CockroachDB module exposes one entrypoint function to create the CockroachDB container, and this function receives two parameters:

```golang
func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*CockroachDBContainer, error)
```

- `context.Context`, the Go context.
- `testcontainers.ContainerCustomizer`, a variadic argument for passing options.

!!!warning
When TLS is enabled there's a very small, unlikely chance that the underlying driver can panic when registering the driver as part of waiting for CockroachDB to be ready to accept connections. If this is repeatedly happening please open an issue.

### Container Options

When starting the CockroachDB container, you can pass options in a variadic way to configure it.

#### Image

If you need to set a different CockroachDB Docker image, you can use `testcontainers.WithImage` with a valid Docker image
for CockroachDB. E.g. `testcontainers.WithImage("cockroachdb/cockroach:latest-v23.1")`.

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

#### Database

Set the database that is created & dialled with `cockroachdb.WithDatabase`.

#### Password authentication

Disable insecure mode and connect with password authentication by setting `cockroachdb.WithUser` and `cockroachdb.WithPassword`.

#### Store size

Control the maximum amount of memory used for storage, by default this is 100% but can be changed by provided a valid option to `WithStoreSize`. Checkout https://www.cockroachlabs.com/docs/stable/cockroach-start#store for the full range of options available.

#### TLS authentication

`cockroachdb.WithTLS` lets you provide the CA certificate along with the certicate and key for the node & clients to connect with.
Internally CockroachDB requires a client certificate for the user to connect with.

A helper `cockroachdb.NewTLSConfig` exists to generate all of this for you.

### Container Methods

The CockroachDB container exposes the following methods:

#### ConnectionString

Dial address to open a new connection.

#### MustConnectionString

Same as `ConnectionString` but any error to generate the address will raise a panic

#### TLSConfig

Returns `*tls.Config` setup to allow you to dial your client over TLS, if enabled, else this will error with `cockroachdb.ErrTLSNotEnabled`.
63 changes: 63 additions & 0 deletions docs/modules/inbucket.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Inbucket

Not available until the next release of testcontainers-go <a href="https://github.com/testcontainers/testcontainers-go"><span class="tc-version">:material-tag: main</span></a>

## Introduction

The Testcontainers module for Inbucket.

## Adding this module to your project dependencies

Please run the following command to add the Inbucket module to your Go dependencies:

```
go get github.com/testcontainers/testcontainers-go/modules/inbucket
```

## Usage example

<!--codeinclude-->
[Creating a Inbucket container](../../modules/inbucket/examples_test.go) inside_block:runInbucketContainer
<!--/codeinclude-->

## Module reference

The Inbucket module exposes one entrypoint function to create the Inbucket container, and this function receives two parameters:

```golang
func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*InbucketContainer, error)
```

- `context.Context`, the Go context.
- `testcontainers.ContainerCustomizer`, a variadic argument for passing options.

### Container Options

When starting the Inbucket container, you can pass options in a variadic way to configure it.

#### Image

If you need to set a different Inbucket Docker image, you can use `testcontainers.WithImage` with a valid Docker image
for Inbucket. E.g. `testcontainers.WithImage("inbucket/inbucket:sha-2d409bb")`.

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

### Container Methods

The Inbucket container exposes the following methods:

#### SmtpConnection

This method returns the connection string to connect to the Inbucket container SMTP service, using the `2500` port.

<!--codeinclude-->
[Get smtp connection string](../../modules/inbucket/inbucket_test.go) inside_block:smtpConnection
<!--/codeinclude-->

#### WebInterface

This method returns the connection string to connect to the Inbucket container web interface, using the `9000` port.

<!--codeinclude-->
[Get web interface connection string](../../modules/inbucket/inbucket_test.go) inside_block:webInterface
<!--/codeinclude-->
69 changes: 69 additions & 0 deletions docs/modules/openldap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# OpenLDAP

Not available until the next release of testcontainers-go <a href="https://github.com/testcontainers/testcontainers-go"><span class="tc-version">:material-tag: main</span></a>

## Introduction

The Testcontainers module for OpenLDAP.

## Adding this module to your project dependencies

Please run the following command to add the OpenLDAP module to your Go dependencies:

```
go get github.com/testcontainers/testcontainers-go/modules/openldap
```

## Usage example

<!--codeinclude-->
[Creating a OpenLDAP container](../../modules/openldap/examples_test.go) inside_block:runOpenLDAPContainer
<!--/codeinclude-->

## Module reference

The OpenLDAP module exposes one entrypoint function to create the OpenLDAP container, and this function receives two parameters:

```golang
func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*OpenLDAPContainer, error)
```

- `context.Context`, the Go context.
- `testcontainers.ContainerCustomizer`, a variadic argument for passing options.

### Container Options

When starting the OpenLDAP container, you can pass options in a variadic way to configure it.

#### Image

If you need to set a different OpenLDAP Docker image, you can use `testcontainers.WithImage` with a valid Docker image
for OpenLDAP. E.g. `testcontainers.WithImage("bitnami/openldap:2.6.6")`.

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

### Container Methods

The OpenLDAP container exposes the following methods:

#### ConnectionString

This method returns the connection string to connect to the OpenLDAP container, using the `1389` port.

<!--codeinclude-->
[Get connection string](../../modules/openldap/openldap_test.go) inside_block:connectionString
<!--/codeinclude-->

#### LoadLdif

This method loads an ldif file in the OpenLDAP server.
It returns and error if there is any problem with the ldif file loading process.

<!--codeinclude-->
[Load ldif](../../modules/openldap/openldap_test.go) inside_block:loadLdif
<!--/codeinclude-->

#### Initial Ldif

If you would like to load an ldif at the initialization of the openldap container, you can use `WithInititialLdif` function.
The file will be copied after the container is started and loaded in openldap.
Loading

0 comments on commit 8948153

Please sign in to comment.