Example #1
0
class TestProbeSSH(unittest.TestCase):
    """Establish a SSH connection on remote host using Probe."""
    def tearDown(self):
        if hasattr(self, 'ssh'):
            self.ssh.close()

    def test_ssh_pubkey_login(self):
        """Test SSH connection using public key."""
        self.ssh = ProbeSSH('localhost')

    def test_ssh_askpass_login(self):
        """Test SSH connection using a username / password."""
        self.ssh = ProbeSSH('localhost', username='******', password='******')

    def test_ssh_timeout(self):
        """Test failure when connection timeout."""
        with self.assertRaises(SystemExit):
            self.ssh = ProbeSSH('1.1.1.1', timeout=1)

    def test_ssh_host_not_found(self):
        """Test failure when host cannot be resolved."""
        with self.assertRaises(SystemExit):
            self.ssh = ProbeSSH('ssh.example.com')

    def test_ssh_no_route(self):
        """Test failure when host cannot be reached."""
        with self.assertRaises(SystemExit):
            self.ssh = ProbeSSH('1.1.1.1')

    def test_ssh_command_timeout(self):
        """Test SSH remote command timeout trigger."""
        self.ssh = ProbeSSH('localhost', timeout=1)
        with self.assertRaises(self.ssh.SSHCommandTimeout):
            self.ssh.execute('sleep 5 && echo success')
class TestProbeSSH(unittest.TestCase):
    """Establish a SSH connection on remote host using Probe."""
    def tearDown(self):
        if hasattr(self, 'ssh'):
            self.ssh.close()

    def test_ssh_pubkey_login(self):
        """Test SSH connection using public key."""
        self.ssh = ProbeSSH('monitoring-dc.app.corp')

    def test_ssh_askpass_login(self):
        """Test SSH connection using a username / password."""
        self.ssh = ProbeSSH('srv1faurdca.idc.us.corp',
                            username='******',
                            password='******')

    def test_ssh_timeout(self):
        """Test failure when connection timeout."""
        with self.assertRaises(SystemExit):
            self.ssh = ProbeSSH('wwfcsunia316.fcs.toa.prim', timeout=1)

    def test_ssh_host_not_found(self):
        """Test failure when host cannot be resolved."""
        with self.assertRaises(SystemExit):
            self.ssh = ProbeSSH('wwfcsunigdsa316.fcs.toa.prim')

    def test_ssh_no_route(self):
        """Test failure when host cannot be reached."""
        with self.assertRaises(SystemExit):
            self.ssh = ProbeSSH('10.56.89.45')

    def test_ssh_command_timeout(self):
        """Test SSH remote command timeout trigger."""
        self.ssh = ProbeSSH('monadm.edc.eu.corp', timeout=1)
        with self.assertRaises(self.ssh.SSHCommandTimeout):
            self.ssh.execute('sleep 5 && echo success')
class TestProbeSSH(unittest.TestCase):
    """Establish a SSH connection on remote host using Probe."""
    def tearDown(self):
        if hasattr(self, 'ssh'):
            self.ssh.close()

    def test_ssh_pubkey_login(self):
        """Test SSH connection using public key."""
        self.ssh = ProbeSSH('localhost')

    def test_ssh_askpass_login(self):
        """Test SSH connection using a username / password."""
        self.ssh = ProbeSSH('localhost',
                            username='******',
                            password='******')

    def test_ssh_timeout(self):
        """Test failure when connection timeout."""
        with self.assertRaises(SystemExit):
            self.ssh = ProbeSSH('1.1.1.1', timeout=1)

    def test_ssh_host_not_found(self):
        """Test failure when host cannot be resolved."""
        with self.assertRaises(SystemExit):
            self.ssh = ProbeSSH('ssh.example.com')

    def test_ssh_no_route(self):
        """Test failure when host cannot be reached."""
        with self.assertRaises(SystemExit):
            self.ssh = ProbeSSH('1.1.1.1')

    def test_ssh_command_timeout(self):
        """Test SSH remote command timeout trigger."""
        self.ssh = ProbeSSH('localhost', timeout=1)
        with self.assertRaises(self.ssh.SSHCommandTimeout):
            self.ssh.execute('sleep 5 && echo success')
 def test_ssh_timeout(self):
     """Test failure when connection timeout."""
     with self.assertRaises(SystemExit):
         self.ssh = ProbeSSH('1.1.1.1', timeout=1)
 def test_ssh_askpass_login(self):
     """Test SSH connection using a username / password."""
     self.ssh = ProbeSSH('localhost',
                         username='******',
                         password='******')
 def test_ssh_pubkey_login(self):
     """Test SSH connection using public key."""
     self.ssh = ProbeSSH('localhost')
Example #7
0
 def test_ssh_command_timeout(self):
     """Test SSH remote command timeout trigger."""
     self.ssh = ProbeSSH('localhost', timeout=1)
     with self.assertRaises(self.ssh.SSHCommandTimeout):
         self.ssh.execute('sleep 5 && echo success')
 def test_ssh_askpass_login(self):
     """Test SSH connection using a username / password."""
     self.ssh = ProbeSSH('srv1faurdca.idc.us.corp',
                         username='******',
                         password='******')
 def test_ssh_command_timeout(self):
     """Test SSH remote command timeout trigger."""
     self.ssh = ProbeSSH('localhost', timeout=1)
     with self.assertRaises(self.ssh.SSHCommandTimeout):
         self.ssh.execute('sleep 5 && echo success')
Example #10
0
 def test_ssh_timeout(self):
     """Test failure when connection timeout."""
     with self.assertRaises(SystemExit):
         self.ssh = ProbeSSH('1.1.1.1', timeout=1)
Example #11
0
 def test_ssh_askpass_login(self):
     """Test SSH connection using a username / password."""
     self.ssh = ProbeSSH('localhost', username='******', password='******')
Example #12
0
 def test_ssh_pubkey_login(self):
     """Test SSH connection using public key."""
     self.ssh = ProbeSSH('localhost')
 def test_ssh_host_not_found(self):
     """Test failure when host cannot be resolved."""
     with self.assertRaises(SystemExit):
         self.ssh = ProbeSSH('wwfcsunigdsa316.fcs.toa.prim')
 def test_ssh_timeout(self):
     """Test failure when connection timeout."""
     with self.assertRaises(SystemExit):
         self.ssh = ProbeSSH('wwfcsunia316.fcs.toa.prim', timeout=1)
 def test_ssh_host_not_found(self):
     """Test failure when host cannot be resolved."""
     with self.assertRaises(SystemExit):
         self.ssh = ProbeSSH('ssh.example.com')
 def test_ssh_no_route(self):
     """Test failure when host cannot be reached."""
     with self.assertRaises(SystemExit):
         self.ssh = ProbeSSH('1.1.1.1')
Example #17
0
 def test_ssh_host_not_found(self):
     """Test failure when host cannot be resolved."""
     with self.assertRaises(SystemExit):
         self.ssh = ProbeSSH('ssh.example.com')
Example #18
0
 def test_ssh_no_route(self):
     """Test failure when host cannot be reached."""
     with self.assertRaises(SystemExit):
         self.ssh = ProbeSSH('1.1.1.1')
 def test_ssh_pubkey_login(self):
     """Test SSH connection using public key."""
     self.ssh = ProbeSSH('monitoring-dc.app.corp')