Search in sources :

Example 1 with OnlineStatusNotification

use of org.jenkinsci.test.acceptance.plugins.mail_watcher.OnlineStatusNotification in project acceptance-test-harness by jenkinsci.

the class MailWatcherPluginTest method notify_master_on_jenkins_restart.

@Test
@Issue("JENKINS-20538")
@Since("1.571")
@WithPlugins("mail-watcher-plugin@1.7")
@Ignore("Flaky test, passes sometimes on CI")
public void notify_master_on_jenkins_restart() throws Exception {
    assumeTrue("This test requires a restartable Jenkins", jenkins.canRestart());
    jenkins.configure();
    {
        OnlineStatusNotification notification = new OnlineStatusNotification(jenkins);
        notification.onOnline("on@online.com");
        notification.onOffline("on@offline.com");
    }
    jenkins.save();
    jenkins.restart();
    mailhog.assertMail(regex("Computer master marked offline"), "on@offline.com", regex("Jenkins is restarting"));
    mailhog.assertMail(regex("Computer master marked online"), "on@online.com");
}
Also used : OnlineStatusNotification(org.jenkinsci.test.acceptance.plugins.mail_watcher.OnlineStatusNotification) Ignore(org.junit.Ignore) Issue(org.jvnet.hudson.test.Issue) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) DockerTest(org.jenkinsci.test.acceptance.junit.DockerTest) Since(org.jenkinsci.test.acceptance.junit.Since) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 2 with OnlineStatusNotification

use of org.jenkinsci.test.acceptance.plugins.mail_watcher.OnlineStatusNotification in project acceptance-test-harness by jenkinsci.

the class MailWatcherPluginTest method notify_slave_on_restart.

@Test
public void notify_slave_on_restart() throws Exception {
    assumeTrue("This test requires a restartable Jenkins", jenkins.canRestart());
    Future<Slave> futureSlave = slaveController.install(jenkins);
    Slave slave = futureSlave.get();
    slave.configure();
    {
        OnlineStatusNotification notification = new OnlineStatusNotification(slave);
        notification.onOnline("on@online.com");
        notification.onOffline("on@offline.com");
    }
    slave.save();
    jenkins.restart();
    mailhog.assertMail(regex("Computer %s marked offline", slave.getName()), "on@offline.com");
    mailhog.assertMail(regex("Computer %s marked online", slave.getName()), "on@online.com");
}
Also used : Slave(org.jenkinsci.test.acceptance.po.Slave) OnlineStatusNotification(org.jenkinsci.test.acceptance.plugins.mail_watcher.OnlineStatusNotification) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) DockerTest(org.jenkinsci.test.acceptance.junit.DockerTest)

Aggregations

AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)2 DockerTest (org.jenkinsci.test.acceptance.junit.DockerTest)2 OnlineStatusNotification (org.jenkinsci.test.acceptance.plugins.mail_watcher.OnlineStatusNotification)2 Test (org.junit.Test)2 Since (org.jenkinsci.test.acceptance.junit.Since)1 WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)1 Slave (org.jenkinsci.test.acceptance.po.Slave)1 Ignore (org.junit.Ignore)1 Issue (org.jvnet.hudson.test.Issue)1