MCPcopy
hub / github.com/hashicorp/packer / TestValidateCommandExcept

Function TestValidateCommandExcept

command/validate_test.go:168–221  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

166}
167
168func 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
223func TestValidateCommand_VarFiles(t *testing.T) {
224 tt := []struct {

Callers

nothing calls this directly

Calls 6

RunMethod · 0.95
testFixtureFunction · 0.85
TestMetaFileFunction · 0.85
cleanupFunction · 0.85
fatalCommandFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…