Search in sources :

Example 1 with MailhogContainer

use of org.jenkinsci.test.acceptance.docker.fixtures.MailhogContainer in project acceptance-test-harness by jenkinsci.

the class MavenPluginTest method send_mail.

@Test
@Issue({ "JENKINS-20209", "JENKINS-21045" })
public void send_mail() throws Exception {
    installSomeMaven(jenkins);
    MailhogContainer mailhog = mailhogProvider.get();
    MavenModuleSet job = jenkins.jobs.create(MavenModuleSet.class);
    job.configure();
    Mailer mailer = job.addBuildSettings(Mailer.class);
    mailer.recipients.set("root@example.com");
    job.save();
    job.startBuild().shouldFail();
    mailhog.assertMail(Pattern.compile("Build failed in Jenkins: .* #1"), "root@example.com", Pattern.compile(job.name));
}
Also used : Mailer(org.jenkinsci.test.acceptance.plugins.mailer.Mailer) MailhogContainer(org.jenkinsci.test.acceptance.docker.fixtures.MailhogContainer) MavenModuleSet(org.jenkinsci.test.acceptance.plugins.maven.MavenModuleSet) Issue(org.jvnet.hudson.test.Issue) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) DockerTest(org.jenkinsci.test.acceptance.junit.DockerTest)

Example 2 with MailhogContainer

use of org.jenkinsci.test.acceptance.docker.fixtures.MailhogContainer in project acceptance-test-harness by jenkinsci.

the class MailhogProvider method get.

@Override
public synchronized MailhogContainer get() {
    MailhogContainer mailhog = super.get();
    jenkins.configure(() -> {
        MailerGlobalConfig mgc = new MailerGlobalConfig(jenkins);
        mgc.smtpServer.set(mailhog.getSmtpHost());
        mgc.advancedButton.click();
        mgc.smtpPort.set(mailhog.getSmtpPort());
    });
    return mailhog;
}
Also used : MailerGlobalConfig(org.jenkinsci.test.acceptance.plugins.mailer.MailerGlobalConfig) MailhogContainer(org.jenkinsci.test.acceptance.docker.fixtures.MailhogContainer)

Example 3 with MailhogContainer

use of org.jenkinsci.test.acceptance.docker.fixtures.MailhogContainer in project acceptance-test-harness by jenkinsci.

the class EmailExtPluginTest method build.

@Test
public void build() {
    MailhogContainer mailhog = mailhogProvider.get();
    FreeStyleJob job = jenkins.jobs.create();
    job.configure();
    job.addShellStep("false");
    EmailExtPublisher pub = job.addPublisher(EmailExtPublisher.class);
    pub.subject.set("Modified $DEFAULT_SUBJECT");
    pub.setRecipient("dev@example.com");
    pub.body.set("$DEFAULT_CONTENT\nwith amendment");
    job.save();
    Build b = job.startBuild().shouldFail();
    mailhog.assertMail(Pattern.compile("^Modified "), "dev@example.com", Pattern.compile("\nwith amendment$"));
}
Also used : Build(org.jenkinsci.test.acceptance.po.Build) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) EmailExtPublisher(org.jenkinsci.test.acceptance.plugins.email_ext.EmailExtPublisher) MailhogContainer(org.jenkinsci.test.acceptance.docker.fixtures.MailhogContainer) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) DockerTest(org.jenkinsci.test.acceptance.junit.DockerTest)

Aggregations

MailhogContainer (org.jenkinsci.test.acceptance.docker.fixtures.MailhogContainer)3 AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)2 DockerTest (org.jenkinsci.test.acceptance.junit.DockerTest)2 Test (org.junit.Test)2 EmailExtPublisher (org.jenkinsci.test.acceptance.plugins.email_ext.EmailExtPublisher)1 Mailer (org.jenkinsci.test.acceptance.plugins.mailer.Mailer)1 MailerGlobalConfig (org.jenkinsci.test.acceptance.plugins.mailer.MailerGlobalConfig)1 MavenModuleSet (org.jenkinsci.test.acceptance.plugins.maven.MavenModuleSet)1 Build (org.jenkinsci.test.acceptance.po.Build)1 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)1 Issue (org.jvnet.hudson.test.Issue)1