Skip to content

Commit 63e7236

Browse files
add tests for prinfo merging
1 parent e401549 commit 63e7236

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/git/tree/GitDataUploaderImpl.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ private void uploadGitData() {
112112
return;
113113
}
114114

115-
if (config.isCiVisibilityGitUnshallowDefer()
116-
&& gitRepoUnshallow.unshallow()) {
115+
if (config.isCiVisibilityGitUnshallowDefer() && gitRepoUnshallow.unshallow()) {
117116
latestCommits = gitClient.getLatestCommits();
118117
commitsToSkip = gitDataApi.searchCommits(remoteUrl, latestCommits);
119118
}

dd-java-agent/agent-ci-visibility/src/main/java/datadog/trace/civisibility/git/tree/GitRepoUnshallow.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import datadog.trace.api.Config;
44
import datadog.trace.civisibility.utils.ShellCommandExecutor;
55
import java.io.IOException;
6-
import java.util.concurrent.CompletableFuture;
7-
import java.util.concurrent.Future;
86
import java.util.concurrent.TimeoutException;
97
import org.slf4j.Logger;
108
import org.slf4j.LoggerFactory;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package datadog.trace.civisibility.ci
2+
3+
import spock.lang.Specification
4+
5+
class PullRequestInfoTest extends Specification {
6+
def "test merging of informations"() {
7+
PullRequestInfo.merge(infoA, infoB) == result
8+
9+
where:
10+
infoA | infoB | result
11+
new PullRequestInfo("branchA", "a", "a") | new PullRequestInfo("branchB", "b", "b") | new PullRequestInfo("branchA", "a", "a")
12+
new PullRequestInfo(null, null, null) | new PullRequestInfo("branchB", "b", "b") | new PullRequestInfo("branchB", "b", "b")
13+
new PullRequestInfo("branchA", null, null) | new PullRequestInfo("branchB", "b", "b") | new PullRequestInfo("branchA", "b", "b")
14+
new PullRequestInfo("branchA", null, null) | new PullRequestInfo(null, null, null) | new PullRequestInfo("branchA", null, null)
15+
}
16+
}

0 commit comments

Comments
 (0)