Skip to content

Commit

Permalink
Merge branch 'main' into issue-525
Browse files Browse the repository at this point in the history
* main:
  chore: bring back assertion for network aliases for bridge in rootless mode (testcontainers#2141)
  chore(deps): bump github.com/docker/compose/v2 from 2.23.3 to 2.24.0 in /modules/compose (testcontainers#2096)
  • Loading branch information
mdelapenya committed Jan 24, 2024
2 parents c731846 + 6297ec1 commit 17f1c53
Show file tree
Hide file tree
Showing 72 changed files with 1,249 additions and 1,463 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-test-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:

- name: golangci-lint
# TODO: Remove each example/module once it passes the golangci-lint
if: ${{ inputs.platform == 'ubuntu-latest' && inputs.go-version == '1.20.x' && !contains(fromJSON('["modules/compose"]'), inputs.project-directory) }}
if: ${{ inputs.platform == 'ubuntu-latest' && inputs.go-version == '1.20.x' }}
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
Expand Down
10 changes: 5 additions & 5 deletions docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func (c *DockerContainer) Start(ctx context.Context) error {
return err
}

if err := c.provider.client.ContainerStart(ctx, c.ID, types.ContainerStartOptions{}); err != nil {
if err := c.provider.client.ContainerStart(ctx, c.ID, container.StartOptions{}); err != nil {
return err
}
defer c.provider.Close()
Expand Down Expand Up @@ -258,7 +258,7 @@ func (c *DockerContainer) Terminate(ctx context.Context) error {
return err
}

err = c.provider.client.ContainerRemove(ctx, c.GetContainerID(), types.ContainerRemoveOptions{
err = c.provider.client.ContainerRemove(ctx, c.GetContainerID(), container.RemoveOptions{
RemoveVolumes: true,
Force: true,
})
Expand Down Expand Up @@ -313,7 +313,7 @@ func (c *DockerContainer) inspectContainer(ctx context.Context) (*types.Containe
func (c *DockerContainer) Logs(ctx context.Context) (io.ReadCloser, error) {
const streamHeaderSize = 8

options := types.ContainerLogsOptions{
options := container.LogsOptions{
ShowStdout: true,
ShowStderr: true,
}
Expand Down Expand Up @@ -686,7 +686,7 @@ func (c *DockerContainer) startLogProduction(ctx context.Context, opts ...LogPro
since := ""
// if the socket is closed we will make additional logs request with updated Since timestamp
BEGIN:
options := types.ContainerLogsOptions{
options := container.LogsOptions{
ShowStdout: true,
ShowStderr: true,
Follow: true,
Expand Down Expand Up @@ -1207,7 +1207,7 @@ func (p *DockerProvider) findContainerByName(ctx context.Context, name string) (

// Note that, 'name' filter will use regex to find the containers
filter := filters.NewArgs(filters.Arg("name", fmt.Sprintf("^%s$", name)))
containers, err := p.client.ContainerList(ctx, types.ContainerListOptions{Filters: filter})
containers, err := p.client.ContainerList(ctx, container.ListOptions{Filters: filter})
if err != nil {
return nil, err
}
Expand Down
5 changes: 3 additions & 2 deletions docker_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/events"
"github.com/docker/docker/api/types/registry"
"github.com/docker/docker/api/types/system"
"github.com/docker/docker/client"

"github.com/testcontainers/testcontainers-go/internal/core"
Expand All @@ -21,7 +22,7 @@ type DockerClient struct {

var (
// dockerInfo stores the docker info to be reused in the Info method
dockerInfo types.Info
dockerInfo system.Info
dockerInfoSet bool
dockerInfoLock sync.Mutex
)
Expand All @@ -37,7 +38,7 @@ func (c *DockerClient) Events(ctx context.Context, options types.EventsOptions)
// Info returns information about the docker server. The result of Info is cached
// and reused every time Info is called.
// It will also print out the docker server info, and the resolved Docker paths, to the default logger.
func (c *DockerClient) Info(ctx context.Context) (types.Info, error) {
func (c *DockerClient) Info(ctx context.Context) (system.Info, error) {
dockerInfoLock.Lock()
defer dockerInfoLock.Unlock()
if dockerInfoSet {
Expand Down
4 changes: 1 addition & 3 deletions docker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,9 +509,7 @@ func TestContainerCreation(t *testing.T) {
t.Errorf("Expected number of connected networks %d. Got %d.", 0, len(networkAliases))
}

if os.Getenv("XDG_RUNTIME_DIR") != "" {
t.Log("[Docker Rootless] do not assert that the container should have zero aliases in the bridge network")
} else if len(networkAliases["bridge"]) != 0 {
if len(networkAliases["bridge"]) != 0 {
t.Errorf("Expected number of aliases for 'bridge' network %d. Got %d.", 0, len(networkAliases["bridge"]))
}
}
Expand Down
13 changes: 10 additions & 3 deletions examples/cockroachdb/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ require (
github.com/containerd/log v0.1.0 // indirect
github.com/cpuguy83/dockercfg v0.3.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/docker/docker v24.0.7+incompatible // indirect
github.com/distribution/reference v0.5.0 // indirect
github.com/docker/docker v25.0.1+incompatible // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
Expand All @@ -41,11 +44,11 @@ require (
github.com/magiconair/properties v1.8.7 // indirect
github.com/moby/patternmatcher v0.6.0 // indirect
github.com/moby/sys/sequential v0.5.0 // indirect
github.com/moby/sys/user v0.1.0 // indirect
github.com/moby/term v0.5.0 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc5 // indirect
github.com/opencontainers/runc v1.1.5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
Expand All @@ -55,6 +58,10 @@ require (
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0 // indirect
go.opentelemetry.io/otel v1.19.0 // indirect
go.opentelemetry.io/otel/metric v1.19.0 // indirect
go.opentelemetry.io/otel/trace v1.19.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect
golang.org/x/mod v0.11.0 // indirect
Expand Down
Loading

0 comments on commit 17f1c53

Please sign in to comment.