Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to deflake CheckFilterTest #522

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,18 @@
import com.cloudbees.jenkins.support.impl.SystemProperties;
import com.cloudbees.jenkins.support.impl.ThreadDumps;
import com.cloudbees.jenkins.support.impl.UpdateCenter;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.EnvVars;
import hudson.ExtensionList;
import hudson.FilePath;
import hudson.Launcher;
import hudson.model.FreeStyleBuild;
import hudson.model.FreeStyleProject;
import hudson.model.Run;
import hudson.model.TaskListener;
import hudson.model.User;
import hudson.model.labels.LabelAtom;
import hudson.model.queue.QueueTaskFuture;
import hudson.tasks.Builder;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.Serializable;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
Expand All @@ -56,14 +49,14 @@
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import jenkins.model.Jenkins;
import jenkins.tasks.SimpleBuildStep;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipFile;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.LoggerRule;

public class CheckFilterTest {
private static final Logger LOGGER = Logger.getLogger(CheckFilterTest.class.getName());
Expand All @@ -79,6 +72,9 @@ public class CheckFilterTest {
@Rule
public JenkinsRule j = new JenkinsRule();

@Rule
public LoggerRule logging = new LoggerRule().record(AsyncResultCache.class, Level.FINER);

@Test
public void checkFilterTest() throws Exception {
// Create the files to check
Expand Down Expand Up @@ -114,6 +110,7 @@ public void checkFilterTest() throws Exception {

// Cancel the job running
build.cancel(true);
j.waitUntilNoActivity();
}

private QueueTaskFuture<FreeStyleBuild> createObjectsWithNames() throws Exception {
Expand Down Expand Up @@ -145,7 +142,6 @@ private QueueTaskFuture<FreeStyleBuild> createObjectsWithNames() throws Exceptio
FreeStyleProject project = j.createFreeStyleProject(JOB_NAME);
project.setAssignedLabel(new LabelAtom("foo")); // it's mandatory

// project.getBuildersList().add(new SimpleBuilder());
return project.scheduleBuild2(0);
}

Expand Down Expand Up @@ -434,17 +430,4 @@ private boolean match(String s) {
return Pattern.matches(pattern, s);
}
}

private static class SimpleBuilder extends Builder implements SimpleBuildStep, Serializable {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Introduced in #174 but never used.

@Override
public void perform(
@NonNull Run<?, ?> run,
@NonNull FilePath filePath,
@NonNull Launcher launcher,
@NonNull TaskListener taskListener)
throws InterruptedException, IOException {
taskListener.getLogger().println("Doing my job, sleeping...");
Thread.sleep(Long.MAX_VALUE);
}
}
}
Loading