コード例 #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')
コード例 #2
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('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')
コード例 #3
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')
コード例 #4
0
 def test_ssh_timeout(self):
     """Test failure when connection timeout."""
     with self.assertRaises(SystemExit):
         self.ssh = ProbeSSH('1.1.1.1', timeout=1)
コード例 #5
0
 def test_ssh_askpass_login(self):
     """Test SSH connection using a username / password."""
     self.ssh = ProbeSSH('localhost',
                         username='******',
                         password='******')
コード例 #6
0
 def test_ssh_pubkey_login(self):
     """Test SSH connection using public key."""
     self.ssh = ProbeSSH('localhost')
コード例 #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')
コード例 #8
0
 def test_ssh_askpass_login(self):
     """Test SSH connection using a username / password."""
     self.ssh = ProbeSSH('srv1faurdca.idc.us.corp',
                         username='******',
                         password='******')
コード例 #9
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')
コード例 #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)
コード例 #11
0
 def test_ssh_askpass_login(self):
     """Test SSH connection using a username / password."""
     self.ssh = ProbeSSH('localhost', username='******', password='******')
コード例 #12
0
 def test_ssh_pubkey_login(self):
     """Test SSH connection using public key."""
     self.ssh = ProbeSSH('localhost')
コード例 #13
0
 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')
コード例 #14
0
 def test_ssh_timeout(self):
     """Test failure when connection timeout."""
     with self.assertRaises(SystemExit):
         self.ssh = ProbeSSH('wwfcsunia316.fcs.toa.prim', timeout=1)
コード例 #15
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')
コード例 #16
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')
コード例 #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')
コード例 #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')
コード例 #19
0
 def test_ssh_pubkey_login(self):
     """Test SSH connection using public key."""
     self.ssh = ProbeSSH('monitoring-dc.app.corp')