/** * Create a new slave on the local host and wait for it to come online * before returning. */ public DumbSlave createOnlineSlave() throws Exception { return createOnlineSlave(null); }
/** * Create a new slave on the local host and wait for it to come online * before returning. */ public DumbSlave createOnlineSlave(Label l) throws Exception { return createOnlineSlave(l, null); }
@BeforeClass public static void setUpAgent() throws Exception { s = j.createOnlineSlave(); s.setLabelString("some-label docker"); }
@BeforeClass public static void setUpAgent() throws Exception { s = j.createOnlineSlave(); s.setLabelString("some-label docker"); }
@BeforeClass public static void setUpAgent() throws Exception { s = j.createOnlineSlave(); s.setLabelString("some-label docker"); }
@BeforeClass public static void setUpAgent() throws Exception { s = j.createOnlineSlave(); s.setLabelString("here"); }
@BeforeClass public static void setUpAgent() throws Exception { s = j.createOnlineSlave(); s.setLabelString("here"); }
@BeforeClass public static void setUpAgent() throws Exception { s = j.createOnlineSlave(); s.setLabelString("here"); }
@BeforeClass public static void setUpAgent() throws Exception { s = j.createOnlineSlave(); s.setNumExecutors(10); s.setLabelString("some-label docker"); }
@Test public void customCacheLocationFromSlave() throws Exception { FreeStyleProject p = j.createFreeStyleProject(); p.setScm(new MercurialSCM(CACHING_INSTALLATION, repo.getPath(), null, null, null, null, false)); p.setAssignedNode(j.createOnlineSlave()); m.hg(repo, "init"); m.touchAndCommit(repo, "a"); String log = m.buildAndCheck(p, "a"); Pattern pattern = Pattern.compile("hg clone .*custom-cache-dir"); Assert.assertTrue(pattern.matcher(log).find()); }
@Test @Issue("JENKINS-50339") public void shouldSerializeException() throws Exception { DumbSlave agent = j.createOnlineSlave(); try { agent.getChannel().call(new ErrorCallable()); } catch (SVNException e) { return; // fine } }
@BeforeClass public static void setUpAgent() throws Exception { s = j.createOnlineSlave(); s.setNumExecutors(4); s.setLabelString("some-label docker test"); s.getNodeProperties().add(new EnvironmentVariablesNodeProperty(new EnvironmentVariablesNodeProperty.Entry("ONAGENT", "true"))); }
@BeforeClass public static void setUpAgent() throws Exception { s = j.createOnlineSlave(); s.setLabelString("some-label docker"); s.getNodeProperties().add( new EnvironmentVariablesNodeProperty( new EnvironmentVariablesNodeProperty.Entry("HAS_BACKSLASHES", "C:\\Windows"), new EnvironmentVariablesNodeProperty.Entry("FOO", "OTHER"))); }
@BeforeClass public static void setUpAgentAndCreds() throws Exception { s = j.createOnlineSlave(); s.setLabelString("some-label docker here"); s.getNodeProperties().add(new EnvironmentVariablesNodeProperty(new EnvironmentVariablesNodeProperty.Entry("ONAGENT", "true"), new EnvironmentVariablesNodeProperty.Entry("WHICH_AGENT", "first"))); s.setNumExecutors(2); s2 = j.createOnlineSlave(); s2.setLabelString("other-docker"); s2.getNodeProperties().add(new EnvironmentVariablesNodeProperty(new EnvironmentVariablesNodeProperty.Entry("ONAGENT", "true"), new EnvironmentVariablesNodeProperty.Entry("WHICH_AGENT", "second"))); CredentialsStore store = CredentialsProvider.lookupStores(j.jenkins).iterator().next(); String usernamePasswordCredentialsId = "FOOcredentials"; UsernamePasswordCredentialsImpl usernamePassword = new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, usernamePasswordCredentialsId, "sample", usernamePasswordUsername, usernamePasswordPassword); store.addCredentials(Domain.global(), usernamePassword); }
@BeforeClass public static void setUpAgent() throws Exception { s = j.createOnlineSlave(); s.setLabelString("some-label docker"); s.getNodeProperties().add(new EnvironmentVariablesNodeProperty(new EnvironmentVariablesNodeProperty.Entry("ONAGENT", "true"), new EnvironmentVariablesNodeProperty.Entry("WHICH_AGENT", "first"))); s.setNumExecutors(2); s2 = j.createOnlineSlave(); s2.setLabelString("other-docker"); s2.getNodeProperties().add(new EnvironmentVariablesNodeProperty(new EnvironmentVariablesNodeProperty.Entry("ONAGENT", "true"), new EnvironmentVariablesNodeProperty.Entry("WHICH_AGENT", "second"))); //setup credentials for docker registry CredentialsStore store = CredentialsProvider.lookupStores(j.jenkins).iterator().next(); password = System.getProperty("docker.password"); if(password != null) { UsernamePasswordCredentialsImpl globalCred = new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, "dockerhub", "real", "jtaboada", password); store.addCredentials(Domain.global(), globalCred); } }
@Test public void runsOnCorrectSlave() throws Exception { assumeDocker(); Slave s = j.createOnlineSlave(); s.setLabelString("notthis"); env(s).put("DOCKER_INDICATOR", "WRONG").set(); s = j.createOnlineSlave(); s.setLabelString("thisone"); env(s).put("DOCKER_INDICATOR", "CORRECT").set(); GlobalConfig.get().setDockerLabel("thisone"); GlobalConfig.get().setRegistry(null); expect("agentDockerEnvTest").runFromRepo(false).logContains("Running on assumed Docker agent").go(); }
@Test public void runsOnSpecifiedSlave() throws Exception { assumeDocker(); Slave s = j.createOnlineSlave(); s.setLabelString("thisspec"); env(s).put("DOCKER_INDICATOR", "SPECIFIED").set(); s = j.createOnlineSlave(); s.setLabelString("thisone"); env(s).put("DOCKER_INDICATOR", "CORRECT").set(); GlobalConfig.get().setDockerLabel("thisone"); GlobalConfig.get().setRegistry(null); expect("agentDockerEnvSpecLabel").runFromRepo(false).logContains("Running on assumed Docker agent").go(); }
@Issue("JENKINS-53734") @Test public void parallelStagesNestedInSequential() throws Exception { Slave s = j.createOnlineSlave(); s.setLabelString("first-agent"); s.getNodeProperties().add(new EnvironmentVariablesNodeProperty(new EnvironmentVariablesNodeProperty.Entry("WHICH_AGENT", "first agent"))); Slave s2 = j.createOnlineSlave(); s2.setLabelString("second-agent"); s2.getNodeProperties().add(new EnvironmentVariablesNodeProperty(new EnvironmentVariablesNodeProperty.Entry("WHICH_AGENT", "second agent"))); expect("parallelStagesNestedInSequential") .logContains("[Pipeline] { (foo)", "First stage, first agent", "[Pipeline] { (inner-first)", "Second stage, second agent", "Apache Maven 3.0.1", "[Pipeline] { (inner-second)") .logNotContains("WE SHOULD NEVER GET HERE") .go(); }
@LocalData @Test public void testSlave() throws Exception { DumbSlave s = rule.createOnlineSlave(); project.setAssignedLabel(s.getSelfLabel()); FilePath src = new FilePath(rule.jenkins.getRootPath(), "jobs/" + BASIC_TEST_PROJECT + "/workspace/"); assertNotNull(src); FilePath dest = s.getWorkspaceFor(project); assertNotNull(dest); src.copyRecursiveTo("*.xml", dest); testBasic(); }
@RandomlyFails("TimeoutException from basic") @LocalData("All") @Test public void slave() throws Exception { DumbSlave s = j.createOnlineSlave(); project.setAssignedLabel(s.getSelfLabel()); FilePath src = new FilePath(j.jenkins.getRootPath(), "jobs/junit/workspace/"); assertNotNull(src); FilePath dest = s.getWorkspaceFor(project); assertNotNull(dest); src.copyRecursiveTo("*.xml", dest); basic(); }