Skip to content

Commit

Permalink
Merge pull request #77 from MarkEWaite/master-test-JENKINS-21434-fixed
Browse files Browse the repository at this point in the history
Test cases related to JENKINS-21434 - alternates file wrong content
  • Loading branch information
ndeloof committed Jan 21, 2014
2 parents 6d50b04 + a7df8d7 commit dc35b60
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/test/java/org/jenkinsci/plugins/gitclient/GitAPITestCase.java
Expand Up @@ -246,6 +246,8 @@ public void test_clone() throws IOException, InterruptedException
}
check_remote_url("origin");
check_branches("master");
final String alternates = ".git" + File.separator + "objects" + File.separator + "info" + File.separator + "alternates";
assertFalse("Alternates file found: " + alternates, w.exists(alternates));
}

public void test_clone_repositoryName() throws IOException, InterruptedException
Expand All @@ -257,6 +259,8 @@ public void test_clone_repositoryName() throws IOException, InterruptedException
}
check_remote_url("upstream");
check_branches("master");
final String alternates = ".git" + File.separator + "objects" + File.separator + "info" + File.separator + "alternates";
assertFalse("Alternates file found: " + alternates, w.exists(alternates));
}

public void test_clone_shallow() throws IOException, InterruptedException
Expand All @@ -268,6 +272,8 @@ public void test_clone_shallow() throws IOException, InterruptedException
}
check_remote_url("origin");
check_branches("master");
final String alternates = ".git" + File.separator + "objects" + File.separator + "info" + File.separator + "alternates";
assertFalse("Alternates file found: " + alternates, w.exists(alternates));
}

/** shared is not implemented in CliGitAPIImpl. */
Expand All @@ -292,6 +298,16 @@ public void test_clone_reference() throws IOException, InterruptedException
}
check_remote_url("origin");
check_branches("master");
final String alternates = ".git" + File.separator + "objects" + File.separator + "info" + File.separator + "alternates";
if (w.git instanceof CliGitAPIImpl) {
assertTrue("Alternates file not found: " + alternates, w.exists(alternates));
final String expectedContent = localMirror().replace("\\", "/") + "/objects";
final String actualContent = w.contentOf(alternates).trim(); // Remove trailing line terminator(s)
assertEquals("Alternates file wrong content", expectedContent, actualContent);
} else {
/* JGit does not implement reference cloning yet */
assertFalse("Alternates file found: " + alternates, w.exists(alternates));
}
}

public void test_detect_commit_in_repo() throws Exception {
Expand Down

0 comments on commit dc35b60

Please sign in to comment.