(t *testing.T)
| 91 | } |
| 92 | |
| 93 | func TestCopyToContainer(t *testing.T) { |
| 94 | t.Parallel() |
| 95 | |
| 96 | testGroups := []*testgroup{ |
| 97 | { |
| 98 | description: "Copying to container, SRC_PATH is a file, absolute", |
| 99 | sourceSpec: filepath.Join(string(os.PathSeparator), srcDirName, srcFileName), |
| 100 | sourceIsAFile: true, |
| 101 | toContainer: true, |
| 102 | testCases: []testcases{ |
| 103 | { |
| 104 | description: "DEST_PATH does not exist, relative", |
| 105 | destinationSpec: pathDoesNotExistRelative, |
| 106 | expect: icmd.Expected{ |
| 107 | ExitCode: 0, |
| 108 | }, |
| 109 | }, |
| 110 | { |
| 111 | description: "DEST_PATH does not exist, absolute", |
| 112 | destinationSpec: pathDoesNotExistAbsolute, |
| 113 | expect: icmd.Expected{ |
| 114 | ExitCode: 0, |
| 115 | }, |
| 116 | }, |
| 117 | { |
| 118 | description: "DEST_PATH does not exist, relative, and ends with " + string(os.PathSeparator), |
| 119 | destinationSpec: pathDoesNotExistRelative + string(os.PathSeparator), |
| 120 | expect: icmd.Expected{ |
| 121 | ExitCode: 1, |
| 122 | Err: containerutil.ErrDestinationDirMustExist.Error(), |
| 123 | }, |
| 124 | }, |
| 125 | { |
| 126 | description: "DEST_PATH does not exist, absolute, and ends with " + string(os.PathSeparator), |
| 127 | destinationSpec: pathDoesNotExistAbsolute + string(os.PathSeparator), |
| 128 | expect: icmd.Expected{ |
| 129 | ExitCode: 1, |
| 130 | Err: containerutil.ErrDestinationDirMustExist.Error(), |
| 131 | }, |
| 132 | }, |
| 133 | |
| 134 | { |
| 135 | description: "DEST_PATH is a file, relative", |
| 136 | destinationSpec: pathIsAFileRelative, |
| 137 | expect: icmd.Expected{ |
| 138 | ExitCode: 0, |
| 139 | }, |
| 140 | setup: func(base *testutil.Base, container string, destPath string) { |
| 141 | base.Cmd("exec", container, "touch", destPath).AssertOK() |
| 142 | }, |
| 143 | }, |
| 144 | { |
| 145 | description: "DEST_PATH is a file, absolute", |
| 146 | destinationSpec: pathIsAFileAbsolute, |
| 147 | expect: icmd.Expected{ |
| 148 | ExitCode: 0, |
| 149 | }, |
| 150 | setup: func(base *testutil.Base, container string, destPath string) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…