Skip to content

Commit ebef11f

Browse files
fix: refactor shallow git tests to use synthetic repo (#10825)
fix: refactor shallow git tests to use synthetic repo Merge branch 'master' into daniel.mohedano/refactor-git-shallow-tests Co-authored-by: daniel.mohedano <daniel.mohedano@datadoghq.com>
1 parent a98b2e0 commit ebef11f

File tree

55 files changed

+116
-33
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+116
-33
lines changed

dd-java-agent/agent-ci-visibility/src/test/groovy/datadog/trace/civisibility/git/tree/GitClientTest.groovy

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ class GitClientTest extends Specification {
8787
8888
def "test is shallow"() {
8989
given:
90-
givenGitRepo("ci/git/shallow/git")
90+
givenGitRepos(["ci/git/shallow_with_origin/origin", "ci/git/shallow_with_origin/repo"])
9191
9292
when:
93-
def gitClient = givenGitClient()
93+
def gitClient = givenGitClient("repo")
9494
def shallow = gitClient.isShallow()
9595
9696
then:
@@ -111,22 +111,22 @@ class GitClientTest extends Specification {
111111
112112
def "test get upstream branch SHA"() {
113113
given:
114-
givenGitRepo("ci/git/shallow/git")
114+
givenGitRepos(["ci/git/shallow_with_origin/origin", "ci/git/shallow_with_origin/repo"])
115115
116116
when:
117-
def gitClient = givenGitClient()
117+
def gitClient = givenGitClient("repo")
118118
def upstreamBranch = gitClient.getUpstreamBranchSha()
119119
120120
then:
121-
upstreamBranch == "98b944cc44f18bfb78e3021de2999cdcda8efdf6"
121+
upstreamBranch == "c76ef954d23f8fdb42dcf2fe956d6af5a31fe7bd"
122122
}
123123
124124
def "test unshallow: sha-#remoteSha"() {
125125
given:
126-
givenGitRepo("ci/git/shallow/git")
126+
givenGitRepos(["ci/git/shallow_with_origin/origin", "ci/git/shallow_with_origin/repo"])
127127
128128
when:
129-
def gitClient = givenGitClient()
129+
def gitClient = givenGitClient("repo")
130130
def shallow = gitClient.isShallow()
131131
def commits = gitClient.getLatestCommits()
132132
@@ -209,11 +209,11 @@ class GitClientTest extends Specification {
209209

210210
def "test get commit info with fetching"() {
211211
given:
212-
givenGitRepo("ci/git/shallow/git")
212+
givenGitRepos(["ci/git/shallow_with_origin/origin", "ci/git/shallow_with_origin/repo"])
213213

214214
when:
215-
def commit = "f4377e97f10c2d58696192b170b2fef2a8464b04"
216-
def gitClient = givenGitClient()
215+
def commit = "6e55a15a35ad46f74e4203dd42f7797173a6edcb"
216+
def gitClient = givenGitClient("repo")
217217
def commitInfo = gitClient.getCommitInfo(commit, false)
218218

219219
then:
@@ -224,13 +224,13 @@ class GitClientTest extends Specification {
224224

225225
then:
226226
commitInfo.sha == commit
227-
commitInfo.author.name == "sullis"
228-
commitInfo.author.email == "github@seansullivan.com"
229-
commitInfo.author.iso8601Date == "2023-05-30T07:07:35-07:00"
230-
commitInfo.committer.name == "GitHub"
231-
commitInfo.committer.email == "noreply@github.com"
232-
commitInfo.committer.iso8601Date == "2023-05-30T07:07:35-07:00"
233-
commitInfo.fullMessage == "brotli4j 1.12.0 (#1592)"
227+
commitInfo.author.name == "Test Author"
228+
commitInfo.author.email == "test-author@example.com"
229+
commitInfo.author.iso8601Date == "2026-03-12T17:02:46+01:00"
230+
commitInfo.committer.name == "Test Author"
231+
commitInfo.committer.email == "test-author@example.com"
232+
commitInfo.committer.iso8601Date == "2026-03-12T17:02:46+01:00"
233+
commitInfo.fullMessage == "Commit message 0"
234234
}
235235

236236
def "test get latest commits"() {

dd-java-agent/agent-ci-visibility/src/test/resources/ci/git/shallow/dummy.txt

Whitespace-only changes.

dd-java-agent/agent-ci-visibility/src/test/resources/ci/git/shallow/git/description

Lines changed: 0 additions & 1 deletion
This file was deleted.
Binary file not shown.

dd-java-agent/agent-ci-visibility/src/test/resources/ci/git/shallow/git/info/exclude

Lines changed: 0 additions & 6 deletions
This file was deleted.

dd-java-agent/agent-ci-visibility/src/test/resources/ci/git/shallow/git/logs/HEAD

Lines changed: 0 additions & 1 deletion
This file was deleted.

dd-java-agent/agent-ci-visibility/src/test/resources/ci/git/shallow/git/logs/refs/heads/master

Lines changed: 0 additions & 1 deletion
This file was deleted.

dd-java-agent/agent-ci-visibility/src/test/resources/ci/git/shallow/git/logs/refs/remotes/origin/HEAD

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)