Skip to content

Commit 7dda4ee

Browse files
committed
Improve test
1 parent 69e534e commit 7dda4ee

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

get_git_test.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ func TestGitGetter_shallowCloneWithTag(t *testing.T) {
172172
dst := tempDir(t)
173173

174174
repo := testGitRepo(t, "upstream")
175-
repo.commitFile("upstream.txt", "0")
176-
repo.commitFile("upstream.txt", "1")
175+
repo.commitFile("v1.0.txt", "0")
177176
repo.git("tag", "v1.0")
177+
repo.commitFile("v1.1.txt", "1")
178178

179179
// Specifiy a clone depth of 1 with a tag
180180
q := repo.url.Query()
@@ -198,6 +198,18 @@ func TestGitGetter_shallowCloneWithTag(t *testing.T) {
198198
if out != "1" {
199199
t.Fatalf("expected rev-list count to be '1' but got %v", out)
200200
}
201+
202+
// Verify the v1.0 file exists
203+
mainPath := filepath.Join(dst, "v1.0.txt")
204+
if _, err := os.Stat(mainPath); err != nil {
205+
t.Fatalf("err: %s", err)
206+
}
207+
208+
// Verify the v1.1 file does not exists
209+
mainPath := filepath.Join(dst, "v1.1.txt")
210+
if _, err := os.Stat(mainPath); err == nil {
211+
t.Fatalf("expected v1.1 file to not exist")
212+
}
201213
}
202214

203215
func TestGitGetter_branchUpdate(t *testing.T) {

0 commit comments

Comments
 (0)