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

Function TestBuildOnlyFileCommaFlags

command/build_test.go:586–617  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

584}
585
586func TestBuildOnlyFileCommaFlags(t *testing.T) {
587 c := &BuildCommand{
588 Meta: TestMetaFile(t),
589 }
590
591 args := []string{
592 "-parallel-builds=1",
593 "-only=chocolate,vanilla",
594 filepath.Join(testFixture("build-only"), "template.json"),
595 }
596
597 defer cleanup()
598
599 if code := c.Run(args); code != 0 {
600 fatalCommand(t, c.Meta)
601 }
602
603 for _, f := range []string{"chocolate.txt", "vanilla.txt",
604 "apple.txt", "peach.txt", "pear.txt", "unnamed.txt"} {
605 if !fileExists(f) {
606 t.Errorf("Expected to find %s", f)
607 }
608 }
609
610 if fileExists("cherry.txt") {
611 t.Error("Expected NOT to find cherry.txt")
612 }
613
614 if !fileExists("tomato.txt") {
615 t.Error("Expected to find tomato.txt")
616 }
617}
618
619func TestBuildStdin(t *testing.T) {
620 c := &BuildCommand{

Callers

nothing calls this directly

Calls 8

RunMethod · 0.95
TestMetaFileFunction · 0.85
testFixtureFunction · 0.85
cleanupFunction · 0.85
fatalCommandFunction · 0.85
fileExistsFunction · 0.70
ErrorMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…