Skip to content

Commit

Permalink
Three test cases were actually asserting the broken behavior!
Browse files Browse the repository at this point in the history
  • Loading branch information
jglick committed Aug 6, 2024
1 parent f091f66 commit 5d205fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import hudson.plugins.git.extensions.impl.LocalBranch;
import hudson.util.StreamTaskListener;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -1043,7 +1044,7 @@ public void refLockEncounteredIfPruneTraitNotPresentOnNotFoundRetrieval() throws

createRefLockEnvironment(listener, source);

final GitException e = assertThrows(GitException.class, () -> source.fetch("v1.2", listener, null));
final IOException e = assertThrows(IOException.class, () -> source.fetch("v1.2", listener, null));
assertFalse(e.getMessage().contains("--prune"));
}

Expand All @@ -1064,7 +1065,7 @@ public void refLockEncounteredIfPruneTraitNotPresentOnTagRetrieval() throws Exce

createRefLockEnvironment(listener, source);

final GitException e = assertThrows(GitException.class, () -> source.fetch("v1.2", listener, null));
final IOException e = assertThrows(IOException.class, () -> source.fetch("v1.2", listener, null));
assertFalse(e.getMessage().contains("--prune"));
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/java/jenkins/plugins/git/FIPSModeSCMSourceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import hudson.logging.LogRecorder;
import hudson.model.TaskListener;
import hudson.plugins.git.GitException;
import hudson.util.StreamTaskListener;
import java.io.IOException;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.RealJenkinsRule;
Expand All @@ -29,7 +29,7 @@ public void remotesAreNotFetchedTest() throws Throwable {
rule.then( r -> {
GitSCMSource source = new GitSCMSource("http://insecure-repo");
TaskListener listener = StreamTaskListener.fromStderr();
assertThrows("expected exception as repo doesn't exist", GitException.class, () -> source.fetch(listener));
assertThrows("expected exception as repo doesn't exist", IOException.class, () -> source.fetch(listener));

LogRecorder logRecorder = new LogRecorder(AbstractGitSCMSource.class.getName());
LogRecorder.Target target = new LogRecorder.Target(AbstractGitSCMSource.class.getName(), Level.SEVERE);
Expand Down

0 comments on commit 5d205fd

Please sign in to comment.