(t *testing.T)
| 166 | } |
| 167 | |
| 168 | func TestValidateCommandExcept(t *testing.T) { |
| 169 | tt := []struct { |
| 170 | name string |
| 171 | args []string |
| 172 | exitCode int |
| 173 | }{ |
| 174 | { |
| 175 | name: "JSON: validate except build and post-processor", |
| 176 | args: []string{ |
| 177 | "-except=vanilla,pear", |
| 178 | filepath.Join(testFixture("validate"), "validate_except.json"), |
| 179 | }, |
| 180 | }, |
| 181 | { |
| 182 | name: "JSON: fail validate except build and post-processor", |
| 183 | args: []string{ |
| 184 | "-except=chocolate,apple", |
| 185 | filepath.Join(testFixture("validate"), "validate_except.json"), |
| 186 | }, |
| 187 | exitCode: 1, |
| 188 | }, |
| 189 | { |
| 190 | name: "HCL2: validate except build and post-processor", |
| 191 | args: []string{ |
| 192 | "-except=file.vanilla,pear", |
| 193 | filepath.Join(testFixture("validate"), "validate_except.pkr.hcl"), |
| 194 | }, |
| 195 | }, |
| 196 | { |
| 197 | name: "HCL2: fail validation except build and post-processor", |
| 198 | args: []string{ |
| 199 | "-except=file.chocolate,apple", |
| 200 | filepath.Join(testFixture("validate"), "validate_except.pkr.hcl"), |
| 201 | }, |
| 202 | exitCode: 1, |
| 203 | }, |
| 204 | } |
| 205 | |
| 206 | c := &ValidateCommand{ |
| 207 | Meta: TestMetaFile(t), |
| 208 | } |
| 209 | c.CoreConfig.Version = "102.0.0" |
| 210 | |
| 211 | for _, tc := range tt { |
| 212 | t.Run(tc.name, func(t *testing.T) { |
| 213 | defer cleanup() |
| 214 | |
| 215 | tc := tc |
| 216 | if code := c.Run(tc.args); code != tc.exitCode { |
| 217 | fatalCommand(t, c.Meta) |
| 218 | } |
| 219 | }) |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | func TestValidateCommand_VarFiles(t *testing.T) { |
| 224 | tt := []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…