Skip to content

Commit a696486

Browse files
authored
Merge pull request #339 from jglick/agentDockerWithCreds
Deleting `agentDockerWithCreds` test
2 parents e2c0289 + 0e9fb60 commit a696486

File tree

2 files changed

+1
-71
lines changed

2 files changed

+1
-71
lines changed

src/test/java/org/jenkinsci/plugins/docker/workflow/declarative/DockerAgentTest.java

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@
2525
package org.jenkinsci.plugins.docker.workflow.declarative;
2626

2727
import com.cloudbees.hudson.plugins.folder.Folder;
28-
import com.cloudbees.plugins.credentials.CredentialsProvider;
29-
import com.cloudbees.plugins.credentials.CredentialsScope;
30-
import com.cloudbees.plugins.credentials.CredentialsStore;
31-
import com.cloudbees.plugins.credentials.domains.Domain;
32-
import com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl;
3328
import hudson.model.Result;
3429
import hudson.model.Slave;
3530
import hudson.slaves.EnvironmentVariablesNodeProperty;
@@ -39,7 +34,6 @@
3934
import org.jenkinsci.plugins.docker.workflow.DockerTestUtil;
4035
import org.jenkinsci.plugins.pipeline.modeldefinition.AbstractModelDefTest;
4136
import static org.jenkinsci.plugins.pipeline.modeldefinition.AbstractModelDefTest.j;
42-
import static org.junit.Assume.assumeTrue;
4337
import org.junit.BeforeClass;
4438
import org.junit.Ignore;
4539
import org.junit.Test;
@@ -53,7 +47,6 @@ public class DockerAgentTest extends AbstractModelDefTest {
5347
private static Slave s;
5448
private static Slave s2;
5549

56-
private static String username, password;
5750
@BeforeClass
5851
public static void setUpAgent() throws Exception {
5952
s = j.createOnlineSlave();
@@ -66,32 +59,14 @@ public static void setUpAgent() throws Exception {
6659
s2.setLabelString("other-docker");
6760
s2.getNodeProperties().add(new EnvironmentVariablesNodeProperty(new EnvironmentVariablesNodeProperty.Entry("ONAGENT", "true"),
6861
new EnvironmentVariablesNodeProperty.Entry("WHICH_AGENT", "second")));
69-
//setup credentials for docker registry
70-
CredentialsStore store = CredentialsProvider.lookupStores(j.jenkins).iterator().next();
71-
72-
username = System.getProperty("docker.username");
73-
password = System.getProperty("docker.password");
74-
75-
if (username != null && password != null) {
76-
UsernamePasswordCredentialsImpl globalCred =
77-
new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL,
78-
"dockerhub", "real", username, password);
79-
80-
store.addCredentials(Domain.global(), globalCred);
81-
82-
}
8362
}
8463

8564
@Test
8665
public void agentDocker() throws Exception {
8766
agentDocker("org/jenkinsci/plugins/docker/workflow/declarative/agentDocker", "-v /tmp:/tmp");
8867
}
8968

90-
@Test
91-
public void agentDockerWithCreds() throws Exception {
92-
assumeTrue(username != null && password != null);
93-
agentDocker("org/jenkinsci/plugins/docker/workflow/declarative/agentDockerWithCreds", "-v /tmp:/tmp");
94-
}
69+
// TODO write test of registryCredentialsId, e.g. using a registry in Testcontainers, or MockLauncherStep as in RegistryEndpointStepTest
9570

9671
@Test
9772
public void agentDockerWithRegistryNoCreds() throws Exception {

src/test/resources/org/jenkinsci/plugins/docker/workflow/declarative/agentDockerWithCreds.groovy

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)