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));
}
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;
}
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$"));
}
Aggregations