(t *testing.T)
| 15 | } |
| 16 | |
| 17 | func 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 | |
| 48 | func TestFileGetter_sourceFile(t *testing.T) { |
| 49 | g := new(FileGetter) |
nothing calls this directly
no test coverage detected