Test that the prompt command exits with 0 when the user sends SIGINT/SIGTERM to the process
(t *testing.T)
| 79 | // Test that the prompt command exits with 0 |
| 80 | // when the user sends SIGINT/SIGTERM to the process |
| 81 | func TestPromptExitCode(t *testing.T) { |
| 82 | t.Parallel() |
| 83 | |
| 84 | ctx, cancel := context.WithCancel(context.Background()) |
| 85 | t.Cleanup(cancel) |
| 86 | |
| 87 | dir := fixtures.SetupConfigFile(t) |
| 88 | t.Cleanup(dir.Remove) |
| 89 | |
| 90 | defaultCmdOpts := []icmd.CmdOp{ |
| 91 | fixtures.WithConfig(dir.Path()), |
| 92 | } |
| 93 | |
| 94 | testCases := []struct { |
| 95 | name string |
| 96 | run func(t *testing.T) icmd.Cmd |
| 97 | }{ |
| 98 | { |
| 99 | name: "volume prune", |
| 100 | run: func(t *testing.T) icmd.Cmd { |
| 101 | t.Helper() |
| 102 | return icmd.Command("docker", "volume", "prune") |
| 103 | }, |
| 104 | }, |
| 105 | { |
| 106 | name: "network prune", |
| 107 | run: func(t *testing.T) icmd.Cmd { |
| 108 | t.Helper() |
| 109 | return icmd.Command("docker", "network", "prune") |
| 110 | }, |
| 111 | }, |
| 112 | { |
| 113 | name: "container prune", |
| 114 | run: func(t *testing.T) icmd.Cmd { |
| 115 | t.Helper() |
| 116 | return icmd.Command("docker", "container", "prune") |
| 117 | }, |
| 118 | }, |
| 119 | { |
| 120 | name: "image prune", |
| 121 | run: func(t *testing.T) icmd.Cmd { |
| 122 | t.Helper() |
| 123 | return icmd.Command("docker", "image", "prune") |
| 124 | }, |
| 125 | }, |
| 126 | { |
| 127 | name: "system prune", |
| 128 | run: func(t *testing.T) icmd.Cmd { |
| 129 | t.Helper() |
| 130 | return icmd.Command("docker", "system", "prune") |
| 131 | }, |
| 132 | }, |
| 133 | { |
| 134 | name: "plugin install", |
| 135 | run: func(t *testing.T) icmd.Cmd { |
| 136 | t.Helper() |
| 137 | t.Skip("flaky test: see https://github.com/docker/cli/issues/6248") |
| 138 |
nothing calls this directly
no test coverage detected
searching dependent graphs…