@@ -13,6 +13,7 @@ import (
1313 "github.com/docker/cli/e2e/internal/fixtures"
1414 "gotest.tools/v3/assert"
1515 "gotest.tools/v3/icmd"
16+ "gotest.tools/v3/skip"
1617)
1718
1819func TestAttachExitCode (t * testing.T ) {
@@ -32,7 +33,13 @@ func withStdinNewline(cmd *icmd.Cmd) {
3233
3334// Regression test for https://github.com/docker/cli/issues/5294
3435func TestAttachInterrupt (t * testing.T ) {
35- result := icmd .RunCommand ("docker" , "run" , "-d" , fixtures .AlpineImage , "sh" , "-c" , "sleep 5" )
36+ // this is a new test, it already did not work (inside dind) when over ssh
37+ // todo(laurazard): make this test work w/ dind over ssh
38+ skip .If (t , strings .Contains (os .Getenv ("DOCKER_HOST" ), "ssh://" ))
39+
40+ // if
41+ result := icmd .RunCommand ("docker" , "run" , "-d" , fixtures .AlpineImage ,
42+ "sh" , "-c" , "trap \" exit 33\" SIGINT; for i in $(seq 100); do sleep 0.1; done; exit 34" )
3643 result .Assert (t , icmd .Success )
3744 containerID := strings .TrimSpace (result .Stdout ())
3845
@@ -49,6 +56,7 @@ func TestAttachInterrupt(t *testing.T) {
4956 c .Process .Signal (os .Interrupt )
5057
5158 _ = c .Wait ()
52- assert .Equal (t , c .ProcessState .ExitCode (), 0 )
53- assert .Equal (t , d .String (), "" )
59+ // the CLI should exit with 33 (the SIGINT was forwarded to the container), and the
60+ // CLI process waited for the container exit and properly captured/set the exit code
61+ assert .Equal (t , c .ProcessState .ExitCode (), 33 )
5462}
0 commit comments