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

Function TestBuildStdin

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

Source from the content-addressed store, hash-verified

617}
618
619func TestBuildStdin(t *testing.T) {
620 c := &BuildCommand{
621 Meta: TestMetaFile(t),
622 }
623 f, err := os.Open(filepath.Join(testFixture("build-only"), "template.json"))
624 if err != nil {
625 t.Fatal(err)
626 }
627 defer f.Close()
628
629 stdin := os.Stdin
630 os.Stdin = f
631 defer func() { os.Stdin = stdin }()
632
633 defer cleanup()
634 if code := c.Run([]string{"-parallel-builds=1", "-"}); code != 0 {
635 fatalCommand(t, c.Meta)
636 }
637
638 for _, f := range []string{"vanilla.txt", "cherry.txt", "chocolate.txt",
639 "unnamed.txt"} {
640 if !fileExists(f) {
641 t.Errorf("Expected to find %s", f)
642 }
643 }
644}
645
646func TestBuildOnlyFileMultipleFlags(t *testing.T) {
647 c := &BuildCommand{

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…