(t *testing.T)
| 11 | const testRepo = "https://github.com/thockin/test" |
| 12 | |
| 13 | func TestGitCliCommit(t *testing.T) { |
| 14 | tempDir := t.TempDir() |
| 15 | |
| 16 | gitRepo, err := NewGitCLIRepository(context.Background(), tempDir) |
| 17 | if err != nil { |
| 18 | t.Fatal(err) |
| 19 | } |
| 20 | |
| 21 | err = gitRepo.Clone(context.Background(), CloneOptions{ |
| 22 | URL: testRepo, |
| 23 | Commit: testCheckoutHash, |
| 24 | }) |
| 25 | if err != nil { |
| 26 | t.Fatal(err) |
| 27 | } |
| 28 | |
| 29 | err = gitRepo.Clone(context.Background(), CloneOptions{ |
| 30 | URL: testRepo, |
| 31 | Commit: testCheckoutHash, |
| 32 | }) |
| 33 | if err != nil { |
| 34 | t.Fatal(err) |
| 35 | } |
| 36 | |
| 37 | hash, err := GetHash(context.Background(), tempDir) |
| 38 | if err != nil { |
| 39 | t.Fatal(err) |
| 40 | } |
| 41 | if hash != testCheckoutHash { |
| 42 | t.Fatalf("Wrong remote, got %s, expected %s", hash, testCheckoutHash) |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | func TestGitCliBranch(t *testing.T) { |
| 47 | tempDir := t.TempDir() |
nothing calls this directly
no test coverage detected