(t *testing.T)
| 12 | ) |
| 13 | |
| 14 | func TestCheckpointRemoveErrors(t *testing.T) { |
| 15 | testCases := []struct { |
| 16 | args []string |
| 17 | checkpointDeleteFunc func(container string, options client.CheckpointRemoveOptions) (client.CheckpointRemoveResult, error) |
| 18 | expectedError string |
| 19 | }{ |
| 20 | { |
| 21 | args: []string{"too-few-arguments"}, |
| 22 | expectedError: "requires 2 arguments", |
| 23 | }, |
| 24 | { |
| 25 | args: []string{"too", "many", "arguments"}, |
| 26 | expectedError: "requires 2 arguments", |
| 27 | }, |
| 28 | { |
| 29 | args: []string{"foo", "bar"}, |
| 30 | checkpointDeleteFunc: func(container string, options client.CheckpointRemoveOptions) (client.CheckpointRemoveResult, error) { |
| 31 | return client.CheckpointRemoveResult{}, errors.New("error deleting checkpoint") |
| 32 | }, |
| 33 | expectedError: "error deleting checkpoint", |
| 34 | }, |
| 35 | } |
| 36 | |
| 37 | for _, tc := range testCases { |
| 38 | cli := test.NewFakeCli(&fakeClient{ |
| 39 | checkpointDeleteFunc: tc.checkpointDeleteFunc, |
| 40 | }) |
| 41 | cmd := newRemoveCommand(cli) |
| 42 | cmd.SetArgs(tc.args) |
| 43 | cmd.SetOut(io.Discard) |
| 44 | cmd.SetErr(io.Discard) |
| 45 | assert.ErrorContains(t, cmd.Execute(), tc.expectedError) |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | func TestCheckpointRemoveWithOptions(t *testing.T) { |
| 50 | var containerID, checkpointID, checkpointDir string |
nothing calls this directly
no test coverage detected
searching dependent graphs…