Skip to content

Commit

Permalink
Merge branch 'main' into feat.request-to-json
Browse files Browse the repository at this point in the history
  • Loading branch information
vinayteki95 authored Oct 21, 2024
2 parents 6d1974e + 60a57d0 commit cba46c4
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## [0.44.0](https://github.com/rudderlabs/rudder-go-kit/compare/v0.43.0...v0.44.0) (2024-10-17)


### Features

* allow retrieval of commits for tags ([#675](https://github.com/rudderlabs/rudder-go-kit/issues/675)) ([801d27b](https://github.com/rudderlabs/rudder-go-kit/commit/801d27b091fd6b834c54bc294e70bf280eb24433))


### Miscellaneous

* add support for WithEnv and WithRepository for transformer resource ([#673](https://github.com/rudderlabs/rudder-go-kit/issues/673)) ([f907f10](https://github.com/rudderlabs/rudder-go-kit/commit/f907f1082e1246b2210be24010f8aa1d47b16d47))

## [0.43.0](https://github.com/rudderlabs/rudder-go-kit/compare/v0.42.2...v0.43.0) (2024-09-27)


Expand Down
13 changes: 11 additions & 2 deletions testhelper/gittest/gittest.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,17 @@ func (s *Server) GetServerCA() []byte {
return getServerCA(s.Server)
}

func (s *Server) GetLatestCommitHash(t testing.TB, branch string) string {
cmd := exec.Command("git", "-c", "http.sslVerify=false", "ls-remote", s.URL, fmt.Sprintf("refs/heads/%s", branch))
func (s *Server) GetLatestCommitHash(t testing.TB, referenceType, ref string) string {
var refType string
switch referenceType {
case "branch":
refType = "heads"
case "tag":
refType = "tags"
default:
require.Fail(t, "invalid refType")
}
cmd := exec.Command("git", "-c", "http.sslVerify=false", "ls-remote", s.URL, fmt.Sprintf("refs/%s/%s", refType, ref))
out, err := cmd.Output()
require.NoError(t, err, "should be able to run the ls-remote command")
commitHash := strings.Split(string(out), "\t")[0]
Expand Down
12 changes: 10 additions & 2 deletions testhelper/gittest/gittest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestGitServer(t *testing.T) {
require.NoError(t, err, "should be able to get the HEAD commit")
require.NotEmpty(t, out, "HEAD commit should not be empty")

latestCommit := s.GetLatestCommitHash(t, "develop")
latestCommit := s.GetLatestCommitHash(t, "branch", "develop")
require.Equal(t, strings.TrimSpace(out), latestCommit, "HEAD commit should match the latest commit")
})

Expand All @@ -79,7 +79,15 @@ func TestGitServer(t *testing.T) {
require.NoError(t, err, "should be able to get the HEAD commit")
require.NotEmpty(t, out, "HEAD commit should not be empty")

latestCommit := s.GetLatestCommitHash(t, "main")
out, err = execCmd("git", "-C", tempDir, "tag", "-a", "v1.0.0", "-m", "tag v1.0.0")
require.NoErrorf(t, err, "should be able to create a new tag: %s", out)
out, err = execCmd("git", "-c", "http.sslVerify=false", "-C", tempDir, "push", "origin", "v1.0.0")
require.NoErrorf(t, err, "should be able to push the new tag: %s", out)

out, err = execCmd("git", "-C", tempDir, "rev-parse", "v1.0.0")
require.NoError(t, err, "should be able to get the HEAD commit")
latestCommit := s.GetLatestCommitHash(t, "tag", "v1.0.0")

require.Equal(t, strings.TrimSpace(out), latestCommit, "HEAD commit should match the latest commit")
})
}
Expand Down

0 comments on commit cba46c4

Please sign in to comment.