Skip to content

Commit 7b813f1

Browse files
authored
Merge pull request #401 from jglick/dockerImage
Deprecate `ArtifactManagerTest` functions taking `DockerImage`
2 parents e334280 + 34fd805 commit 7b813f1

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

src/test/java/org/jenkinsci/plugins/workflow/ArtifactManagerTest.java

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ public class ArtifactManagerTest {
9898
}
9999

100100
/**
101-
* Sets up a Docker image, if Docker support is available in this environment.
102-
* Used by {@link #artifactArchiveAndDelete} etc.
101+
* @deprecated Not actually used externally.
103102
*/
103+
@Deprecated
104104
public static @CheckForNull DockerImage prepareImage() throws Exception {
105105
Docker docker = new Docker();
106106
if (!Functions.isWindows() && docker.isAvailable()) { // TODO: Windows agents on ci.jenkins.io have Docker, but cannot build the image.
@@ -151,9 +151,8 @@ private static void wrapInContainer(@NonNull JenkinsRule r, @CheckForNull Artifa
151151
/**
152152
* Test artifact archiving with a manager that does <em>not</em> honor deletion requests.
153153
* @param weirdCharacters as in {@link #artifactArchiveAndDelete}
154-
* @param image as in {@link #artifactArchiveAndDelete}
155154
*/
156-
public static void artifactArchive(@NonNull JenkinsRule r, @CheckForNull ArtifactManagerFactory factory, boolean weirdCharacters, @CheckForNull DockerImage image) throws Exception {
155+
public static void artifactArchive(@NonNull JenkinsRule r, @CheckForNull ArtifactManagerFactory factory, boolean weirdCharacters) throws Exception {
157156
wrapInContainer(r, factory, weirdCharacters, (agent, p, b, ws) -> {
158157
VirtualFile root = b.getArtifactManager().root();
159158
new Verify(agent, root, weirdCharacters).run();
@@ -162,13 +161,16 @@ public static void artifactArchive(@NonNull JenkinsRule r, @CheckForNull Artifac
162161
assertTrue(b.getArtifactManager().root().child("file").isFile());
163162
});
164163
}
164+
@Deprecated
165+
public static void artifactArchive(@NonNull JenkinsRule r, @CheckForNull ArtifactManagerFactory factory, boolean weirdCharacters, @CheckForNull DockerImage image) throws Exception {
166+
artifactArchive(r, factory, weirdCharacters);
167+
}
165168

166169
/**
167170
* Test artifact archiving in a plain manager.
168171
* @param weirdCharacters check behavior of files with Unicode and various unusual characters in the name
169-
* @param image use {@link #prepareImage} in a {@link BeforeClass} block
170172
*/
171-
public static void artifactArchiveAndDelete(@NonNull JenkinsRule r, @CheckForNull ArtifactManagerFactory factory, boolean weirdCharacters, @CheckForNull DockerImage image) throws Exception {
173+
public static void artifactArchiveAndDelete(@NonNull JenkinsRule r, @CheckForNull ArtifactManagerFactory factory, boolean weirdCharacters) throws Exception {
172174
wrapInContainer(r, factory, weirdCharacters, (agent, p, b, ws) -> {
173175
VirtualFile root = b.getArtifactManager().root();
174176
new Verify(agent, root, weirdCharacters).run();
@@ -178,27 +180,33 @@ public static void artifactArchiveAndDelete(@NonNull JenkinsRule r, @CheckForNul
178180
assertFalse(b.getArtifactManager().delete());
179181
});
180182
}
183+
@Deprecated
184+
public static void artifactArchiveAndDelete(@NonNull JenkinsRule r, @CheckForNull ArtifactManagerFactory factory, boolean weirdCharacters, @CheckForNull DockerImage image) throws Exception {
185+
artifactArchiveAndDelete(r, factory, weirdCharacters);
186+
}
181187

182188
/**
183189
* Test stashing and unstashing with a {@link StashManager.StashAwareArtifactManager} that does <em>not</em> honor deletion requests.
184190
* @param weirdCharacters as in {@link #artifactArchiveAndDelete}
185-
* @param image as in {@link #artifactArchiveAndDelete}
186191
*/
187-
public static void artifactStash(@NonNull JenkinsRule r, @CheckForNull ArtifactManagerFactory factory, boolean weirdCharacters, @CheckForNull DockerImage image) throws Exception {
192+
public static void artifactStash(@NonNull JenkinsRule r, @CheckForNull ArtifactManagerFactory factory, boolean weirdCharacters) throws Exception {
188193
wrapInContainer(r, factory, weirdCharacters,
189194
new StashFunction(r, weirdCharacters, (p, b, ws, launcher, env, listener) -> {
190195
// should not have deleted
191196
StashManager.unstash(b, "stuff", ws, launcher, env, listener);
192197
assertTrue(ws.child("file").exists());
193198
}));
194199
}
200+
@Deprecated
201+
public static void artifactStash(@NonNull JenkinsRule r, @CheckForNull ArtifactManagerFactory factory, boolean weirdCharacters, @CheckForNull DockerImage image) throws Exception {
202+
artifactStash(r, factory, weirdCharacters);
203+
}
195204

196205
/**
197206
* Test stashing and unstashing with a {@link StashManager.StashAwareArtifactManager} with standard behavior.
198207
* @param weirdCharacters as in {@link #artifactArchiveAndDelete}
199-
* @param image as in {@link #artifactArchiveAndDelete}
200208
*/
201-
public static void artifactStashAndDelete(@NonNull JenkinsRule r, @CheckForNull ArtifactManagerFactory factory, boolean weirdCharacters, @CheckForNull DockerImage image) throws Exception {
209+
public static void artifactStashAndDelete(@NonNull JenkinsRule r, @CheckForNull ArtifactManagerFactory factory, boolean weirdCharacters) throws Exception {
202210
wrapInContainer(r, factory, weirdCharacters,
203211
new StashFunction(r, weirdCharacters, (p, b, ws, launcher, env, listener) -> {
204212
try {
@@ -210,6 +218,10 @@ public static void artifactStashAndDelete(@NonNull JenkinsRule r, @CheckForNull
210218
assertFalse(ws.child("file").exists());
211219
}));
212220
}
221+
@Deprecated
222+
public static void artifactStashAndDelete(@NonNull JenkinsRule r, @CheckForNull ArtifactManagerFactory factory, boolean weirdCharacters, @CheckForNull DockerImage image) throws Exception {
223+
artifactStashAndDelete(r, factory, weirdCharacters);
224+
}
213225

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

0 commit comments

Comments
 (0)