Skip to content

Commit

Permalink
[JENKINS-25735] [JENKINS-41955] - Tests should invalidate caches wher…
Browse files Browse the repository at this point in the history
…e possible
  • Loading branch information
oleg-nenashev committed Mar 16, 2017
1 parent ffd1d9b commit d3d8c23
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
Expand Up @@ -182,7 +182,7 @@ public synchronized void clear() {
invalidatePasswordValueClassCaches();
}

public synchronized void invalidatePasswordValueClassCaches() {
/*package*/ synchronized void invalidatePasswordValueClassCaches() {
paramValueCache_maskedClasses.clear();
paramValueCache_nonMaskedClasses.clear();
}
Expand Down
Expand Up @@ -42,6 +42,7 @@
import java.net.URLEncoder;
import java.util.Set;
import java.util.TreeSet;
import org.junit.Before;

@Issue("JENKINS-34908")
public class MaskPasswordsURLEncodingTest {
Expand All @@ -52,7 +53,11 @@ public class MaskPasswordsURLEncodingTest {
@Rule
public RestartableJenkinsRule story = new RestartableJenkinsRule();


@Before
public void dropCache() {
MaskPasswordsConfig.getInstance().clear();
}

@Test
public void passwordMaskedEncoded() throws Exception {
story.addStep(new Statement() {
Expand Down
Expand Up @@ -47,6 +47,7 @@
import org.jenkinsci.plugins.workflow.test.steps.SemaphoreStep;
import org.junit.Test;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.runners.model.Statement;
Expand All @@ -63,6 +64,11 @@ public class MaskPasswordsWorkflowTest {
@Rule
public RestartableJenkinsRule story = new RestartableJenkinsRule();

@Before
public void dropCache() {
MaskPasswordsConfig.getInstance().clear();
}

@Test
public void configRoundTrip() throws Exception {
story.addStep(new Statement() {
Expand Down
Expand Up @@ -39,6 +39,7 @@
import java.io.IOException;
import java.util.Collections;
import org.junit.Assert;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
Expand All @@ -59,6 +60,11 @@ public class PasswordParameterTest {
@Rule
public JenkinsRule j = new JenkinsRule();

@Before
public void dropCache() {
MaskPasswordsConfig.getInstance().clear();
}

@Test
@Issue("JENKINS-41955")
public void shouldMaskPasswordParameterClassByDefault() {
Expand Down

0 comments on commit d3d8c23

Please sign in to comment.