Files
sablier/pkg/provider/docker/events_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

46 lines
1.1 KiB
Go

package docker_test
import (
"context"
"github.com/docker/docker/api/types/container"
"github.com/neilotoole/slogt"
"github.com/sablierapp/sablier/pkg/provider/docker"
"gotest.tools/v3/assert"
"testing"
"time"
)
func TestDockerClassicProvider_NotifyInstanceStopped(t *testing.T) {
if testing.Short() {
t.Skip("skipping test in short mode.")
}
ctx, cancel := context.WithTimeout(t.Context(), 30*time.Second)
defer cancel()
dind := setupDinD(t)
p, err := docker.New(ctx, dind.client, slogt.New(t))
assert.NilError(t, err)
c, err := dind.CreateMimic(ctx, MimicOptions{})
assert.NilError(t, err)
inspected, err := dind.client.ContainerInspect(ctx, c.ID)
assert.NilError(t, err)
err = dind.client.ContainerStart(ctx, c.ID, container.StartOptions{})
assert.NilError(t, err)
<-time.After(1 * time.Second)
waitC := make(chan string)
go p.NotifyInstanceStopped(ctx, waitC)
err = dind.client.ContainerStop(ctx, c.ID, container.StopOptions{})
assert.NilError(t, err)
name := <-waitC
// Docker container name is prefixed with a slash, but we don't use it
assert.Equal(t, "/"+name, inspected.Name)
}