| 19 | ) |
| 20 | |
| 21 | func TestRunCopyWithInvalidArguments(t *testing.T) { |
| 22 | testcases := []struct { |
| 23 | doc string |
| 24 | options copyOptions |
| 25 | expectedErr string |
| 26 | }{ |
| 27 | { |
| 28 | doc: "copy between container", |
| 29 | options: copyOptions{ |
| 30 | source: "first:/path", |
| 31 | destination: "second:/path", |
| 32 | }, |
| 33 | expectedErr: "copying between containers is not supported", |
| 34 | }, |
| 35 | { |
| 36 | doc: "copy without a container", |
| 37 | options: copyOptions{ |
| 38 | source: "./source", |
| 39 | destination: "./dest", |
| 40 | }, |
| 41 | expectedErr: "must specify at least one container source", |
| 42 | }, |
| 43 | } |
| 44 | for _, testcase := range testcases { |
| 45 | t.Run(testcase.doc, func(t *testing.T) { |
| 46 | err := runCopy(context.TODO(), test.NewFakeCli(nil), testcase.options) |
| 47 | assert.Error(t, err, testcase.expectedErr) |
| 48 | }) |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | func TestRunCopyFromContainerToStdout(t *testing.T) { |
| 53 | tarContent := "the tar content" |