@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()); }
/** * Used for experimenting the memory leak problem. * This test by itself doesn't detect that, but I'm leaving it in anyway. */ @Issue("JENKINS-8061") @Test public void pollingLeak() throws Exception { Proc p = runSvnServe(getClass().getResource("small.zip")); try { FreeStyleProject b = r.createFreeStyleProject(); b.setScm(new SubversionSCM("svn://localhost/")); b.setAssignedNode(r.createSlave()); r.assertBuildStatusSuccess(b.scheduleBuild2(0)); b.poll(new StreamTaskListener(System.out,Charset.defaultCharset())); } finally { p.kill(); } }
/** * There was a bug that credentials stored in the remote call context was serialized wrongly. */ @Issue("JENKINS-8061") @Test public void remoteBuild() throws Exception { Proc p = runSvnServe(SubversionSCMTest.class.getResource("HUDSON-1379.zip")); try { SystemCredentialsProvider.getInstance().setDomainCredentialsMap(Collections.singletonMap(Domain.global(), Arrays.<Credentials>asList( new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, "1-alice", null, "alice", "alice") ) )); FreeStyleProject b = r.createFreeStyleProject(); b.setScm(new SubversionSCM("svn://localhost/bob", "1-alice", ".")); b.setAssignedNode(r.createSlave()); FreeStyleBuild run = r.buildAndAssertSuccess(b); /* TODO runSvnServe not guaranteed to use port 3690; otherwise this works: assertLogContains(Messages.CredentialsSVNAuthenticationProviderImpl_sole_credentials("alice/******", "<svn://localhost:3690> 8a677b3a-1c61-4b23-9212-1bf3c3d713a7"), run); */ } finally { p.kill(); } } }
p.setScm(new MercurialSCM(hgInstallation(), repo.getPath(), null, null, null, null, false)); p.setAssignedNode(s1); m.hg(repo, "init"); m.touchAndCommit(repo, "dir1/f1"); b = p.scheduleBuild2(0).get(); assertTrue(b.getChangeSet().isEmptySet()); p.setAssignedNode(s2); m.touchAndCommit(repo, "dir2/f1"); b = p.scheduleBuild2(0).get(); p.setAssignedNode(s1); m.touchAndCommit(repo, "dir3/f1"); b = p.scheduleBuild2(0).get();
@Issue({"JENKINS-13329", "JENKINS-15829"}) @Test public void basics() throws Exception { FreeStyleProject p = j.createFreeStyleProject(); p.setScm(new MercurialSCM(inst != null ? inst.getName() : null, repo.getRemote(), null, null, null, null, false)); if (slave != null) { p.setAssignedNode(slave); } m.hg(repo, "init"); m.touchAndCommit(repo, "a"); String log = m.buildAndCheck(p, "a"); assertClone(log, true); m.touchAndCommit(repo, "b"); log = m.buildAndCheck(p, "b"); assertClone(log, false); }