e2e/cli-plugins: rename var that shadowed import
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Родитель
cad08ff3b1
Коммит
5e7948ec83
|
@ -37,7 +37,7 @@ func TestPluginSocketBackwardsCompatible(t *testing.T) {
|
|||
err := syscall.Kill(-command.Process.Pid, syscall.SIGINT)
|
||||
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") {
|
||||
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
|
||||
// ignores the received signal, and the plugin receives a SIGINT
|
||||
// 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
|
||||
|
@ -95,13 +95,13 @@ func TestPluginSocketBackwardsCompatible(t *testing.T) {
|
|||
err := syscall.Kill(command.Process.Pid, syscall.SIGINT)
|
||||
assert.NilError(t, err, "failed to signal process group")
|
||||
}()
|
||||
bytes, err := command.CombinedOutput()
|
||||
t.Log("command output: " + string(bytes))
|
||||
out, err := command.CombinedOutput()
|
||||
t.Log("command output: " + string(out))
|
||||
assert.NilError(t, err, "failed to run command")
|
||||
|
||||
// the plugin process does not receive a SIGINT
|
||||
// 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) {
|
||||
|
@ -130,13 +130,13 @@ func TestPluginSocketBackwardsCompatible(t *testing.T) {
|
|||
err = syscall.Kill(command.Process.Pid, syscall.SIGINT)
|
||||
assert.NilError(t, err, "failed to signal process group")
|
||||
}()
|
||||
bytes, err := command.CombinedOutput()
|
||||
out, err := command.CombinedOutput()
|
||||
assert.ErrorContains(t, err, "exit status 1")
|
||||
|
||||
// the plugin process does not receive a SIGINT and does
|
||||
// the CLI cannot cancel it over the socket, so it kills
|
||||
// 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)
|
||||
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") {
|
||||
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
|
||||
// ignores the received signal, and the plugin receives a SIGINT
|
||||
// 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")
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче