Skip to content

Commit 47ef295

Browse files
committed
test:add ci for cleanup fifos
Signed-off-by: ningmingxiao <[email protected]>
1 parent bd89fee commit 47ef295

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

cmd/nerdctl/container/container_stop_linux_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,23 @@ func TestStopWithTimeout(t *testing.T) {
199199
// The container should get the SIGKILL before the 10s default timeout
200200
assert.Assert(t, elapsed < 10*time.Second, "Container did not respect --timeout flag")
201201
}
202+
func TestStopCleanupFIFOs(t *testing.T) {
203+
if rootlessutil.IsRootless() {
204+
t.Skip("/run/containerd/fifo/ doesn't exist on rootless")
205+
}
206+
testutil.DockerIncompatible(t)
207+
base := testutil.NewBase(t)
208+
testContainerName := testutil.Identifier(t)
209+
oldNumFifos, err := countFIFOFiles("/run/containerd/fifo/")
210+
assert.NilError(t, err)
211+
// Stop the container after 2 seconds
212+
go func() {
213+
time.Sleep(2 * time.Second)
214+
base.Cmd("stop", testContainerName).AssertOK()
215+
newNumFifos, err := countFIFOFiles("/run/containerd/fifo/")
216+
assert.NilError(t, err)
217+
assert.Equal(t, oldNumFifos, newNumFifos)
218+
}()
219+
// Start a container that is automatically removed after it exits
220+
base.Cmd("run", "--rm", "--name", testContainerName, testutil.NginxAlpineImage).AssertOK()
221+
}

0 commit comments

Comments
 (0)