MCPcopy
hub / github.com/hashicorp/go-getter / TestFileGetter

Function TestFileGetter

get_file_test.go:17–46  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15}
16
17func TestFileGetter(t *testing.T) {
18 g := new(FileGetter)
19 dst := testing_helper.TempDir(t)
20 ctx := context.Background()
21
22 req := &Request{
23 Dst: dst,
24 u: testModuleURL("basic"),
25 }
26
27 // With a dir that doesn't exist
28 if err := g.Get(ctx, req); err != nil {
29 t.Fatalf("err: %s", err)
30 }
31
32 // Verify the destination folder is a symlink
33 fi, err := os.Lstat(dst)
34 if err != nil {
35 t.Fatalf("err: %s", err)
36 }
37 if fi.Mode()&os.ModeSymlink == 0 {
38 t.Fatal("destination is not a symlink")
39 }
40
41 // Verify the main file exists
42 mainPath := filepath.Join(dst, "main.tf")
43 if _, err := os.Stat(mainPath); err != nil {
44 t.Fatalf("err: %s", err)
45 }
46}
47
48func TestFileGetter_sourceFile(t *testing.T) {
49 g := new(FileGetter)

Callers

nothing calls this directly

Calls 3

testModuleURLFunction · 0.85
GetMethod · 0.65
ModeMethod · 0.65

Tested by

no test coverage detected