mirror of https://github.com/docker/cli.git
e2e/cli-plugins: rename var that shadowed import
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
cad08ff3b1
commit
5e7948ec83
|
@ -37,7 +37,7 @@ func TestPluginSocketBackwardsCompatible(t *testing.T) {
|
||||||
err := syscall.Kill(-command.Process.Pid, syscall.SIGINT)
|
err := syscall.Kill(-command.Process.Pid, syscall.SIGINT)
|
||||||
assert.NilError(t, err, "failed to signal process group")
|
assert.NilError(t, err, "failed to signal process group")
|
||||||
}()
|
}()
|
||||||
bytes, err := io.ReadAll(ptmx)
|
out, err := io.ReadAll(ptmx)
|
||||||
if err != nil && !strings.Contains(err.Error(), "input/output error") {
|
if err != nil && !strings.Contains(err.Error(), "input/output error") {
|
||||||
t.Fatal("failed to get command output")
|
t.Fatal("failed to get command output")
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ func TestPluginSocketBackwardsCompatible(t *testing.T) {
|
||||||
// the plugin is attached to the TTY, so the parent process
|
// the plugin is attached to the TTY, so the parent process
|
||||||
// ignores the received signal, and the plugin receives a SIGINT
|
// ignores the received signal, and the plugin receives a SIGINT
|
||||||
// as well
|
// as well
|
||||||
assert.Equal(t, string(bytes), "received SIGINT\r\nexit after 3 seconds\r\n")
|
assert.Equal(t, string(out), "received SIGINT\r\nexit after 3 seconds\r\n")
|
||||||
})
|
})
|
||||||
|
|
||||||
// ensure that we don't break plugins that attempt to read from the TTY
|
// ensure that we don't break plugins that attempt to read from the TTY
|
||||||
|
@ -95,13 +95,13 @@ func TestPluginSocketBackwardsCompatible(t *testing.T) {
|
||||||
err := syscall.Kill(command.Process.Pid, syscall.SIGINT)
|
err := syscall.Kill(command.Process.Pid, syscall.SIGINT)
|
||||||
assert.NilError(t, err, "failed to signal process group")
|
assert.NilError(t, err, "failed to signal process group")
|
||||||
}()
|
}()
|
||||||
bytes, err := command.CombinedOutput()
|
out, err := command.CombinedOutput()
|
||||||
t.Log("command output: " + string(bytes))
|
t.Log("command output: " + string(out))
|
||||||
assert.NilError(t, err, "failed to run command")
|
assert.NilError(t, err, "failed to run command")
|
||||||
|
|
||||||
// the plugin process does not receive a SIGINT
|
// the plugin process does not receive a SIGINT
|
||||||
// so it exits after 3 seconds and prints this message
|
// so it exits after 3 seconds and prints this message
|
||||||
assert.Equal(t, string(bytes), "exit after 3 seconds\n")
|
assert.Equal(t, string(out), "exit after 3 seconds\n")
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("the main CLI exits after 3 signals", func(t *testing.T) {
|
t.Run("the main CLI exits after 3 signals", func(t *testing.T) {
|
||||||
|
@ -130,13 +130,13 @@ func TestPluginSocketBackwardsCompatible(t *testing.T) {
|
||||||
err = syscall.Kill(command.Process.Pid, syscall.SIGINT)
|
err = syscall.Kill(command.Process.Pid, syscall.SIGINT)
|
||||||
assert.NilError(t, err, "failed to signal process group")
|
assert.NilError(t, err, "failed to signal process group")
|
||||||
}()
|
}()
|
||||||
bytes, err := command.CombinedOutput()
|
out, err := command.CombinedOutput()
|
||||||
assert.ErrorContains(t, err, "exit status 1")
|
assert.ErrorContains(t, err, "exit status 1")
|
||||||
|
|
||||||
// the plugin process does not receive a SIGINT and does
|
// the plugin process does not receive a SIGINT and does
|
||||||
// the CLI cannot cancel it over the socket, so it kills
|
// the CLI cannot cancel it over the socket, so it kills
|
||||||
// the plugin process and forcefully exits
|
// the plugin process and forcefully exits
|
||||||
assert.Equal(t, string(bytes), "got 3 SIGTERM/SIGINTs, forcefully exiting\n")
|
assert.Equal(t, string(out), "got 3 SIGTERM/SIGINTs, forcefully exiting\n")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ func TestPluginSocketCommunication(t *testing.T) {
|
||||||
err := syscall.Kill(-command.Process.Pid, syscall.SIGINT)
|
err := syscall.Kill(-command.Process.Pid, syscall.SIGINT)
|
||||||
assert.NilError(t, err, "failed to signal process group")
|
assert.NilError(t, err, "failed to signal process group")
|
||||||
}()
|
}()
|
||||||
bytes, err := io.ReadAll(ptmx)
|
out, err := io.ReadAll(ptmx)
|
||||||
if err != nil && !strings.Contains(err.Error(), "input/output error") {
|
if err != nil && !strings.Contains(err.Error(), "input/output error") {
|
||||||
t.Fatal("failed to get command output")
|
t.Fatal("failed to get command output")
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ func TestPluginSocketCommunication(t *testing.T) {
|
||||||
// the plugin is attached to the TTY, so the parent process
|
// the plugin is attached to the TTY, so the parent process
|
||||||
// ignores the received signal, and the plugin receives a SIGINT
|
// ignores the received signal, and the plugin receives a SIGINT
|
||||||
// as well
|
// as well
|
||||||
assert.Equal(t, string(bytes), "received SIGINT\r\nexit after 3 seconds\r\n")
|
assert.Equal(t, string(out), "received SIGINT\r\nexit after 3 seconds\r\n")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue