MCPcopy Index your code
hub / github.com/devspace-sh/devspace / TestGoGit

Function TestGoGit

pkg/util/git/git_test.go:80–123  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

78}
79
80func TestGoGit(t *testing.T) {
81 tempDir := t.TempDir()
82
83 gitRepo := NewGoGitRepository(tempDir, testRepo)
84 err := gitRepo.Update(true)
85 if err != nil {
86 t.Fatal(err)
87 }
88 err = gitRepo.Update(false)
89 if err != nil {
90 t.Fatal(err)
91 }
92
93 remote, err := GetRemote(tempDir)
94 if err != nil {
95 t.Fatal(err)
96 }
97 if remote != testRepo {
98 t.Fatalf("Wrong remote, got %s, expected %s", remote, testRepo)
99 }
100
101 err = gitRepo.Checkout("", "", testCheckoutHash)
102 if err != nil {
103 t.Fatal(err)
104 }
105
106 hash, err := GetHash(context.Background(), tempDir)
107 if err != nil {
108 t.Fatal(err)
109 }
110 if hash != testCheckoutHash {
111 t.Fatalf("Wrong remote, got %s, expected %s", hash, testCheckoutHash)
112 }
113
114 err = gitRepo.Checkout("", testBranch, "")
115 if err != nil {
116 t.Fatal(err)
117 }
118
119 err = gitRepo.Checkout(testTag, "", "")
120 if err != nil {
121 t.Fatal(err)
122 }
123}

Callers

nothing calls this directly

Calls 7

UpdateMethod · 0.95
CheckoutMethod · 0.95
NewGoGitRepositoryFunction · 0.85
GetRemoteFunction · 0.85
GetHashFunction · 0.85
FatalMethod · 0.45
FatalfMethod · 0.45

Tested by

no test coverage detected