Skip to content
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 @@ -98,9 +98,9 @@ public class ArtifactManagerTest {
}

/**
* Sets up a Docker image, if Docker support is available in this environment.
* Used by {@link #artifactArchiveAndDelete} etc.
* @deprecated Not actually used externally.
*/
@Deprecated
public static @CheckForNull DockerImage prepareImage() throws Exception {
Docker docker = new Docker();
if (!Functions.isWindows() && docker.isAvailable()) { // TODO: Windows agents on ci.jenkins.io have Docker, but cannot build the image.
Expand Down Expand Up @@ -151,9 +151,8 @@ private static void wrapInContainer(@NonNull JenkinsRule r, @CheckForNull Artifa
/**
* Test artifact archiving with a manager that does <em>not</em> honor deletion requests.
* @param weirdCharacters as in {@link #artifactArchiveAndDelete}
* @param image as in {@link #artifactArchiveAndDelete}
*/
public static void artifactArchive(@NonNull JenkinsRule r, @CheckForNull ArtifactManagerFactory factory, boolean weirdCharacters, @CheckForNull DockerImage image) throws Exception {
public static void artifactArchive(@NonNull JenkinsRule r, @CheckForNull ArtifactManagerFactory factory, boolean weirdCharacters) throws Exception {
wrapInContainer(r, factory, weirdCharacters, (agent, p, b, ws) -> {
VirtualFile root = b.getArtifactManager().root();
new Verify(agent, root, weirdCharacters).run();
Expand All @@ -162,13 +161,16 @@ public static void artifactArchive(@NonNull JenkinsRule r, @CheckForNull Artifac
assertTrue(b.getArtifactManager().root().child("file").isFile());
});
}
@Deprecated
public static void artifactArchive(@NonNull JenkinsRule r, @CheckForNull ArtifactManagerFactory factory, boolean weirdCharacters, @CheckForNull DockerImage image) throws Exception {
artifactArchive(r, factory, weirdCharacters);
}

/**
* Test artifact archiving in a plain manager.
* @param weirdCharacters check behavior of files with Unicode and various unusual characters in the name
* @param image use {@link #prepareImage} in a {@link BeforeClass} block
*/
public static void artifactArchiveAndDelete(@NonNull JenkinsRule r, @CheckForNull ArtifactManagerFactory factory, boolean weirdCharacters, @CheckForNull DockerImage image) throws Exception {
public static void artifactArchiveAndDelete(@NonNull JenkinsRule r, @CheckForNull ArtifactManagerFactory factory, boolean weirdCharacters) throws Exception {
wrapInContainer(r, factory, weirdCharacters, (agent, p, b, ws) -> {
VirtualFile root = b.getArtifactManager().root();
new Verify(agent, root, weirdCharacters).run();
Expand All @@ -178,27 +180,33 @@ public static void artifactArchiveAndDelete(@NonNull JenkinsRule r, @CheckForNul
assertFalse(b.getArtifactManager().delete());
});
}
@Deprecated
public static void artifactArchiveAndDelete(@NonNull JenkinsRule r, @CheckForNull ArtifactManagerFactory factory, boolean weirdCharacters, @CheckForNull DockerImage image) throws Exception {
artifactArchiveAndDelete(r, factory, weirdCharacters);
}

/**
* Test stashing and unstashing with a {@link StashManager.StashAwareArtifactManager} that does <em>not</em> honor deletion requests.
* @param weirdCharacters as in {@link #artifactArchiveAndDelete}
* @param image as in {@link #artifactArchiveAndDelete}
*/
public static void artifactStash(@NonNull JenkinsRule r, @CheckForNull ArtifactManagerFactory factory, boolean weirdCharacters, @CheckForNull DockerImage image) throws Exception {
public static void artifactStash(@NonNull JenkinsRule r, @CheckForNull ArtifactManagerFactory factory, boolean weirdCharacters) throws Exception {
wrapInContainer(r, factory, weirdCharacters,
new StashFunction(r, weirdCharacters, (p, b, ws, launcher, env, listener) -> {
// should not have deleted
StashManager.unstash(b, "stuff", ws, launcher, env, listener);
assertTrue(ws.child("file").exists());
}));
}
@Deprecated
public static void artifactStash(@NonNull JenkinsRule r, @CheckForNull ArtifactManagerFactory factory, boolean weirdCharacters, @CheckForNull DockerImage image) throws Exception {
artifactStash(r, factory, weirdCharacters);
}

/**
* Test stashing and unstashing with a {@link StashManager.StashAwareArtifactManager} with standard behavior.
* @param weirdCharacters as in {@link #artifactArchiveAndDelete}
* @param image as in {@link #artifactArchiveAndDelete}
*/
public static void artifactStashAndDelete(@NonNull JenkinsRule r, @CheckForNull ArtifactManagerFactory factory, boolean weirdCharacters, @CheckForNull DockerImage image) throws Exception {
public static void artifactStashAndDelete(@NonNull JenkinsRule r, @CheckForNull ArtifactManagerFactory factory, boolean weirdCharacters) throws Exception {
wrapInContainer(r, factory, weirdCharacters,
new StashFunction(r, weirdCharacters, (p, b, ws, launcher, env, listener) -> {
try {
Expand All @@ -210,6 +218,10 @@ public static void artifactStashAndDelete(@NonNull JenkinsRule r, @CheckForNull
assertFalse(ws.child("file").exists());
}));
}
@Deprecated
public static void artifactStashAndDelete(@NonNull JenkinsRule r, @CheckForNull ArtifactManagerFactory factory, boolean weirdCharacters, @CheckForNull DockerImage image) throws Exception {
artifactStashAndDelete(r, factory, weirdCharacters);
}

/**
* Creates a variety of files in a directory structure designed to exercise interesting aspects of {@link VirtualFile}.
Expand Down