Files
sablier/pkg/provider/docker/container_start_test.go
dependabot[bot] 52ce80d46c build(deps): bump the testcontainers-go group across 1 directory with 3 updates (#578)
* build(deps): bump the testcontainers-go group across 1 directory with 3 updates

Bumps the testcontainers-go group with 3 updates in the / directory: [github.com/testcontainers/testcontainers-go](https://github.com/testcontainers/testcontainers-go), [github.com/testcontainers/testcontainers-go/modules/k3s](https://github.com/testcontainers/testcontainers-go) and [github.com/testcontainers/testcontainers-go/modules/valkey](https://github.com/testcontainers/testcontainers-go).


Updates `github.com/testcontainers/testcontainers-go` from 0.35.0 to 0.36.0
- [Release notes](https://github.com/testcontainers/testcontainers-go/releases)
- [Commits](https://github.com/testcontainers/testcontainers-go/compare/v0.35.0...v0.36.0)

Updates `github.com/testcontainers/testcontainers-go/modules/k3s` from 0.35.0 to 0.36.0
- [Release notes](https://github.com/testcontainers/testcontainers-go/releases)
- [Commits](https://github.com/testcontainers/testcontainers-go/compare/v0.35.0...v0.36.0)

Updates `github.com/testcontainers/testcontainers-go/modules/valkey` from 0.35.0 to 0.36.0
- [Release notes](https://github.com/testcontainers/testcontainers-go/releases)
- [Commits](https://github.com/testcontainers/testcontainers-go/compare/v0.35.0...v0.36.0)

---
updated-dependencies:
- dependency-name: github.com/testcontainers/testcontainers-go
  dependency-version: 0.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: testcontainers-go
- dependency-name: github.com/testcontainers/testcontainers-go/modules/k3s
  dependency-version: 0.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: testcontainers-go
- dependency-name: github.com/testcontainers/testcontainers-go/modules/valkey
  dependency-version: 0.36.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: testcontainers-go
...

Signed-off-by: dependabot[bot] <support@github.com>

* use dind module for docker based tests

* do not use testcontainers dind module fork

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alexis Couvreur <alexiscouvreur.pro@gmail.com>
2025-03-31 23:49:58 -04:00

65 lines
1.3 KiB
Go

package docker_test
import (
"context"
"fmt"
"github.com/neilotoole/slogt"
"github.com/sablierapp/sablier/pkg/provider/docker"
"gotest.tools/v3/assert"
"testing"
)
func TestDockerClassicProvider_Start(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode.")
}
ctx := context.Background()
type args struct {
do func(dind *dindContainer) (string, error)
}
tests := []struct {
name string
args args
err error
}{
{
name: "non existing container start",
args: args{
do: func(dind *dindContainer) (string, error) {
return "non-existent", nil
},
},
err: fmt.Errorf("cannot start container non-existent: Error response from daemon: No such container: non-existent"),
},
{
name: "container start as expected",
args: args{
do: func(dind *dindContainer) (string, error) {
c, err := dind.CreateMimic(ctx, MimicOptions{})
return c.ID, err
},
},
err: nil,
},
}
c := setupDinD(t)
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
p, err := docker.New(ctx, c.client, slogt.New(t))
assert.NilError(t, err)
name, err := tt.args.do(c)
assert.NilError(t, err)
err = p.InstanceStart(t.Context(), name)
if tt.err != nil {
assert.Error(t, err, tt.err.Error())
} else {
assert.NilError(t, err)
}
})
}
}