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

Function TestHgGetter_branch

get_hg_test.go:56–96  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

54}
55
56func TestHgGetter_branch(t *testing.T) {
57 if !testHasHg {
58 t.Log("hg not found, skipping")
59 t.Skip()
60 }
61 ctx := context.Background()
62
63 g := new(HgGetter)
64 dst := testing_helper.TempDir(t)
65
66 url := testModuleURL("basic-hg")
67 q := url.Query()
68 q.Add("rev", "test-branch")
69 url.RawQuery = q.Encode()
70
71 req := &Request{
72 Dst: dst,
73 u: url,
74 }
75
76 if err := g.Get(ctx, req); err != nil {
77 t.Fatalf("err: %s", err)
78 }
79
80 // Verify the main file exists
81 mainPath := filepath.Join(dst, "main_branch.tf")
82 if _, err := os.Stat(mainPath); err != nil {
83 t.Fatalf("err: %s", err)
84 }
85
86 // Get again should work
87 if err := g.Get(ctx, req); err != nil {
88 t.Fatalf("err: %s", err)
89 }
90
91 // Verify the main file exists
92 mainPath = filepath.Join(dst, "main_branch.tf")
93 if _, err := os.Stat(mainPath); err != nil {
94 t.Fatalf("err: %s", err)
95 }
96}
97
98func TestHgGetter_GetFile(t *testing.T) {
99 if !testHasHg {

Callers

nothing calls this directly

Calls 2

testModuleURLFunction · 0.85
GetMethod · 0.65

Tested by

no test coverage detected