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

Function TestBuildOnlyFileMultipleFlags

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

Source from the content-addressed store, hash-verified

644}
645
646func TestBuildOnlyFileMultipleFlags(t *testing.T) {
647 c := &BuildCommand{
648 Meta: TestMetaFile(t),
649 }
650
651 args := []string{
652 "-parallel-builds=1",
653 "-only=chocolate",
654 "-only=cherry",
655 "-only=apple", // ignored
656 "-only=peach", // ignored
657 "-only=pear", // ignored
658 filepath.Join(testFixture("build-only"), "template.json"),
659 }
660
661 defer cleanup()
662
663 if code := c.Run(args); code != 0 {
664 fatalCommand(t, c.Meta)
665 }
666
667 for _, f := range []string{"vanilla.txt", "tomato.txt"} {
668 if fileExists(f) {
669 t.Errorf("Expected NOT to find %s", f)
670 }
671 }
672 for _, f := range []string{"chocolate.txt", "cherry.txt",
673 "apple.txt", "peach.txt", "pear.txt", "unnamed.txt"} {
674 if !fileExists(f) {
675 t.Errorf("Expected to find %s", f)
676 }
677 }
678}
679
680func TestBuildProvisionAndPosProcessWithBuildVariablesSharing(t *testing.T) {
681 c := &BuildCommand{

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…