Search in sources :

Example 6 with JenkinsConfig

use of org.jenkinsci.test.acceptance.po.JenkinsConfig in project acceptance-test-harness by jenkinsci.

the class CompressingArtifactManager method setup.

public static void setup(Jenkins jenkins) {
    JenkinsConfig config = jenkins.getConfigPage();
    config.configure();
    config.clearArtifactManagers();
    config.addArtifactManager(CompressingArtifactManager.class);
    config.save();
}
Also used : JenkinsConfig(org.jenkinsci.test.acceptance.po.JenkinsConfig)

Example 7 with JenkinsConfig

use of org.jenkinsci.test.acceptance.po.JenkinsConfig in project acceptance-test-harness by jenkinsci.

the class ConfigurationAsCodeTest method loadAndReload.

@Test
public void loadAndReload() {
    final String EXPECTED_DESC = "JCasC populated description";
    JcascManage jm = new JcascManage(jenkins);
    jm.open();
    jm.configure(resource("/configuration_as_code/trivial.yaml").asFile().getAbsolutePath());
    assertThat(jenkins.open(), hasContent(EXPECTED_DESC));
    JenkinsConfig gc = jenkins.getConfigPage();
    gc.configure(() -> gc.setDescription("Changed"));
    assertThat(jenkins.open(), Matchers.not(hasContent(EXPECTED_DESC)));
    jm.open();
    jm.reload();
    assertThat(jenkins.open(), hasContent(EXPECTED_DESC));
}
Also used : JenkinsConfig(org.jenkinsci.test.acceptance.po.JenkinsConfig) JcascManage(org.jenkinsci.test.acceptance.plugins.configuration_as_code.JcascManage) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Example 8 with JenkinsConfig

use of org.jenkinsci.test.acceptance.po.JenkinsConfig in project acceptance-test-harness by jenkinsci.

the class SubversionPluginTest method poll_for_changes.

@Test
public void poll_for_changes() throws SubversionPluginTestException {
    final SvnContainer svnContainer = svn.get();
    JenkinsConfig jc = new JenkinsConfig(jenkins);
    jc.configure();
    jc.setQuietPeriod(0);
    jc.save();
    final FreeStyleJob f = jenkins.jobs.create();
    final SubversionScm subversionScm = f.useScm(SubversionScm.class);
    subversionScm.url.set(svnContainer.getUrlUnauthenticatedRepoAtRevision(1));
    f.save();
    f.startBuild().shouldSucceed();
    f.configure();
    subversionScm.url.set(svnContainer.getUrlUnauthenticatedRepoAtRevision(2));
    f.pollScm().schedule("* * * * *");
    f.addShellStep("test -d .svn");
    f.save();
    elasticSleep(10000);
    f.build(1).waitUntilFinished().shouldSucceed();
}
Also used : SvnContainer(org.jenkinsci.test.acceptance.docker.fixtures.SvnContainer) SubversionScm(org.jenkinsci.test.acceptance.plugins.subversion.SubversionScm) JenkinsConfig(org.jenkinsci.test.acceptance.po.JenkinsConfig) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) DockerTest(org.jenkinsci.test.acceptance.junit.DockerTest)

Example 9 with JenkinsConfig

use of org.jenkinsci.test.acceptance.po.JenkinsConfig in project acceptance-test-harness by jenkinsci.

the class DeployPluginTest method deploy_sample_webapp_to_tomcat7.

@Test
@Native("bash")
@WithCredentials(credentialType = WithCredentials.USERNAME_PASSWORD, values = { "admin", "tomcat" }, id = "tomcat")
public void deploy_sample_webapp_to_tomcat7() throws IOException, InterruptedException {
    if (SystemUtils.IS_OS_WINDOWS) {
        // TODO move somewhere else...
        String path = new CommandBuilder("where.exe", "bash.exe").popen().asText().trim();
        // where will return all matches and we only want the first.
        path = path.replaceAll("\r\n.*", "");
        JenkinsConfig conf = jenkins.getConfigPage();
        JenkinsConfig cp = jenkins.getConfigPage();
        cp.configure();
        cp.setShell(path);
        cp.save();
    }
    Tomcat7Container f = docker.get();
    FreeStyleJob j = jenkins.jobs.create();
    j.configure();
    ShellBuildStep s;
    {
        s = j.addShellStep(resource("/deploy_plugin/build-war.sh"));
        DeployPublisher d = j.addPublisher(DeployPublisher.class);
        d.war.set("my-webapp/target/*.war");
        d.contextPath.set("test");
        d.useContainer("Tomcat 7.x Remote", "Tomcat 7.x");
        d.setCredentials("tomcat");
        d.url.set(f.getUrl().toExternalForm());
    }
    j.save();
    Build b = j.startBuild().shouldSucceed();
    b.shouldContainsConsoleOutput("to container Tomcat 7.x Remote");
    assertThat(readText(f), containsString("Hello World!"));
    j.configure();
    s.command("cd my-webapp && echo '<html><body>Hello Jenkins</body></html>' > src/main/webapp/index.jsp && mvn install");
    j.save();
    b = j.startBuild().shouldSucceed();
    b.shouldContainsConsoleOutput("Redeploying");
    assertThat(readText(f), containsString("Hello Jenkins"));
}
Also used : DeployPublisher(org.jenkinsci.test.acceptance.plugins.deploy.DeployPublisher) Build(org.jenkinsci.test.acceptance.po.Build) JenkinsConfig(org.jenkinsci.test.acceptance.po.JenkinsConfig) ShellBuildStep(org.jenkinsci.test.acceptance.po.ShellBuildStep) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Tomcat7Container(org.jenkinsci.test.acceptance.docker.fixtures.Tomcat7Container) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) CommandBuilder(org.jenkinsci.utils.process.CommandBuilder) Test(org.junit.Test)

Example 10 with JenkinsConfig

use of org.jenkinsci.test.acceptance.po.JenkinsConfig in project acceptance-test-harness by jenkinsci.

the class PrioritySorterPluginTest method saving_global_config_should_not_create_job_change.

// Reproduce regression fixed in https://github.com/jenkinsci/priority-sorter-plugin/commit/e46b2b1fbc4396f441c69692eb328fb982325572
@Test
@WithPlugins("jobConfigHistory")
public void saving_global_config_should_not_create_job_change() {
    FreeStyleJob job = jenkins.jobs.create();
    job.save();
    JobConfigHistory action = job.action(JobConfigHistory.class);
    final int expected = action.getChanges().size();
    final JenkinsConfig global = jenkins.getConfigPage();
    global.configure();
    global.numExecutors.set(42);
    global.save();
    assertThat(action.getChanges().size(), equalTo(expected));
}
Also used : JobConfigHistory(org.jenkinsci.test.acceptance.plugins.job_config_history.JobConfigHistory) JenkinsConfig(org.jenkinsci.test.acceptance.po.JenkinsConfig) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Aggregations

JenkinsConfig (org.jenkinsci.test.acceptance.po.JenkinsConfig)12 Test (org.junit.Test)7 AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)6 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)4 FormValidation (org.jenkinsci.test.acceptance.po.FormValidation)3 VersionNumber (hudson.util.VersionNumber)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 SvnContainer (org.jenkinsci.test.acceptance.docker.fixtures.SvnContainer)1 Tomcat7Container (org.jenkinsci.test.acceptance.docker.fixtures.Tomcat7Container)1 DockerTest (org.jenkinsci.test.acceptance.junit.DockerTest)1 WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)1 ArtifactoryGlobalConfig (org.jenkinsci.test.acceptance.plugins.artifactory.ArtifactoryGlobalConfig)1 Server (org.jenkinsci.test.acceptance.plugins.artifactory.ArtifactoryGlobalConfig.Server)1 JcascManage (org.jenkinsci.test.acceptance.plugins.configuration_as_code.JcascManage)1 DeployPublisher (org.jenkinsci.test.acceptance.plugins.deploy.DeployPublisher)1 GlobalDockerConfig (org.jenkinsci.test.acceptance.plugins.docker_build_step.GlobalDockerConfig)1 JobConfigHistory (org.jenkinsci.test.acceptance.plugins.job_config_history.JobConfigHistory)1 MissionControlView (org.jenkinsci.test.acceptance.plugins.mission_control.MissionControlView)1 OpenstackCloud (org.jenkinsci.test.acceptance.plugins.openstack.OpenstackCloud)1 SubversionScm (org.jenkinsci.test.acceptance.plugins.subversion.SubversionScm)1