Skip to content

Commit f572000

Browse files
committed
Disable singing of commits in tests
On machines where signing commits requires input these tests will make it failing, and is not really revelvant for the test. Signed-off-by: Bernát Gábor <[email protected]>
1 parent 7ec47d8 commit f572000

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

opengrok-indexer/src/test/java/org/opengrok/indexer/history/FileHistoryCacheTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ static void changeFileAndCommit(Git git, File file, String comment) throws Excep
823823
fos.write(comment.getBytes(StandardCharsets.UTF_8));
824824
}
825825

826-
git.commit().setMessage(comment).setAuthor(authorName, authorEmail).setAll(true).call();
826+
git.commit().setSign(false).setMessage(comment).setAuthor(authorName, authorEmail).setAll(true).call();
827827
}
828828

829829
/**
@@ -868,7 +868,7 @@ void testRenamedFileHistoryWithPerPartes(int maxCount) throws Exception {
868868
assertTrue(fooFile.renameTo(barFile));
869869
git.add().addFilepattern("bar.txt").call();
870870
git.rm().addFilepattern("foo.txt").call();
871-
git.commit().setMessage("rename").setAuthor("foo", "foo@bar").setAll(true).call();
871+
git.commit().setSign(false).setMessage("rename").setAuthor("foo", "foo@bar").setAll(true).call();
872872

873873
changeFileAndCommit(git, barFile, "4");
874874
changeFileAndCommit(git, barFile, "5");

opengrok-indexer/src/test/java/org/opengrok/indexer/history/GitRepositoryTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ void testDetermineCurrentVersionAfterChange() throws Exception {
180180
String comment = "Added testfile";
181181
String authorName = "Foo Bar";
182182
gitClone.commit()
183+
.setSign(false)
183184
.setMessage(comment)
184185
.setAuthor(authorName, "[email protected]")
185186
.call();
@@ -255,7 +256,7 @@ void testGetHistoryInBranch() throws Exception {
255256
int numEntries = history.getHistoryEntries().size();
256257
assertTrue(numEntries > 0);
257258

258-
RevCommit commit = gitClone.commit().
259+
RevCommit commit = gitClone.commit().setSign(false).
259260
setAuthor("Snufkin", "[email protected]").
260261
setMessage("fresh commit on a new branch").setAllowEmpty(true).call();
261262
assertNotNull(commit);

opengrok-indexer/src/test/java/org/opengrok/indexer/index/IndexDatabaseTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ static RevCommit changeFileAndCommit(Git git, File file, String comment) throws
318318
}
319319

320320
private static RevCommit commitFile(Git git, String comment, String authorName, String authorEmail) throws GitAPIException {
321-
return git.commit().setMessage(comment).setAuthor(authorName, authorEmail).setAll(true).call();
321+
return git.commit().setSign(false).setMessage(comment).setAuthor(authorName, authorEmail).setAll(true).call();
322322
}
323323

324324
private void addFileAndCommit(Git git, String newFileName, File repositoryRoot, String message) throws Exception {
@@ -359,7 +359,7 @@ private void addMergeCommit(Git git, File repositoryRoot) throws Exception {
359359

360360
// Commit the merge separately so that the author can be set.
361361
// (MergeCommand - a result of git.merge() - does not have the setAuthor() method)
362-
git.commit().setAuthor("foo bar", "[email protected]").call();
362+
git.commit().setSign(false).setAuthor("foo bar", "[email protected]").call();
363363
}
364364

365365
private void changeGitRepository(File repositoryRoot) throws Exception {
@@ -396,7 +396,7 @@ private void changeGitRepository(File repositoryRoot, boolean addSymlinks) throw
396396
File rmFile = new File(repositoryRoot, deletedFileName);
397397
assertTrue(rmFile.exists());
398398
git.rm().addFilepattern(deletedFileName).call();
399-
git.commit().setMessage("delete").setAuthor("foo", "[email protected]").setAll(true).call();
399+
git.commit().setSign(false).setMessage("delete").setAuthor("foo", "[email protected]").setAll(true).call();
400400
assertFalse(rmFile.exists());
401401

402402
// Rename some file.
@@ -408,7 +408,7 @@ private void changeGitRepository(File repositoryRoot, boolean addSymlinks) throw
408408
assertTrue(fooFile.renameTo(barFile));
409409
git.add().addFilepattern(barFileName).call();
410410
git.rm().addFilepattern(fooFileName).call();
411-
git.commit().setMessage("rename").setAuthor("foo", "[email protected]").setAll(true).call();
411+
git.commit().setSign(false).setMessage("rename").setAuthor("foo", "[email protected]").setAll(true).call();
412412
assertTrue(barFile.exists());
413413
assertFalse(fooFile.exists());
414414

@@ -441,7 +441,7 @@ private void addSymlinksToGitRepository(Git git, File repositoryRoot) throws Exc
441441
addFilepattern(fileLinkName).
442442
addFilepattern(dirLinkName).call();
443443

444-
git.commit().setMessage("add symlinks").setAuthor("foo", "[email protected]").
444+
git.commit().setSign(false).setMessage("add symlinks").setAuthor("foo", "[email protected]").
445445
setAll(true).call();
446446
}
447447

@@ -1154,6 +1154,7 @@ void testNullifiedChanges() throws Exception {
11541154
changeFileAndCommit(gitParent, barFile, "change bar");
11551155

11561156
// Revert the changes done to foo.txt so that the changes got nullified for the subsequent pull.
1157+
gitParent.getRepository().getConfig().setBoolean("commit", null, "gpgsign", false);
11571158
gitParent.revert().include(commit).call();
11581159

11591160
// Bring the changes to the repository to be indexed. Again, done for better simulation.

opengrok-indexer/src/test/java/org/opengrok/indexer/index/IndexerVsDeletedDocumentsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ void testIndexTraversalWithDeletedDocuments(boolean projectsEnabled, boolean use
266266
}
267267
}
268268
if (gitRepo != null) {
269-
gitRepo.commit().setMessage("initial content").setAuthor(authorName, authorEmail).call();
269+
gitRepo.commit().setSign(false).setMessage("initial content").setAuthor(authorName, authorEmail).call();
270270
}
271271
// Add the project and optionally detect the Git repository.
272272
env.setProjects(new HashMap<>());
@@ -324,7 +324,7 @@ void testIndexTraversalWithDeletedDocuments(boolean projectsEnabled, boolean use
324324
}
325325

326326
if (gitRepo != null) {
327-
gitRepo.commit().setMessage(String.format("iteration %d", i)).setAuthor(authorName, authorEmail).call();
327+
gitRepo.commit().setSign(false).setMessage(String.format("iteration %d", i)).setAuthor(authorName, authorEmail).call();
328328
}
329329

330330
listener.reset();

0 commit comments

Comments
 (0)