def test_args_secure_connection(self): args = ('--secure-connection', 'non-default') result = check_docker.process_args(args=args) self.assertEqual(result.secure_connection, 'non-default') args = ('--secure-connection', 'foo.com/bar') result = check_docker.process_args(args=args) self.assertEqual(result.secure_connection, 'foo.com/bar') self.assertEqual(check_docker.daemon, 'https://foo.com/bar')
def test_args_connection(self): args = ('--connection', '/foo') result = check_docker.process_args(args=args) self.assertEqual(result.connection, '/foo') self.assertEqual(check_docker.daemon, 'socket:///foo:') args = ('--connection', 'foo.com/bar') result = check_docker.process_args(args=args) self.assertEqual(result.connection, 'foo.com/bar') self.assertEqual(check_docker.daemon, 'http://foo.com/bar')
def test_args_timeout(self): args = ('--timeout', '9999') result = check_docker.process_args(args=args) self.assertEqual(result.timeout, 9999.0)
def test_args_containers(self): args = ('--containers', 'non-default') result = check_docker.process_args(args=args) self.assertListEqual(result.containers, ['non-default'])
def test_args_memory(self): args = ('--memory', 'non-default') result = check_docker.process_args(args=args) self.assertEqual(result.memory, 'non-default')
def test_args_status(self): args = ('--status', 'non-default') result = check_docker.process_args(args=args) self.assertEqual(result.status, 'non-default')
def test_args_restart(self): args = ('--restarts', 'non-default') result = check_docker.process_args(args=args) self.assertEqual(result.restarts, 'non-default')
def test_socketfile_failure_http(self): self.fs.CreateFile('/tmp/http', contents='', st_mode=(stat.S_IFSOCK | 0o000)) args = ('--status', 'running', '--connection', 'http://127.0.0.1') result = check_docker.process_args(args=args) self.assertFalse(check_docker.socketfile_permissions_failure(parsed_args=result))
def test_args_status(self): args = ('--status', 'non-default') result = check_docker.process_args(args=args) self.assertEqual(result.status, 'non-default')
def test_socketfile_failure_missing(self): args = ('--status', 'running', '--connection', '/tmp/missing') result = check_docker.process_args(args=args) self.assertTrue(check_docker.socketfile_permissions_failure(parsed_args=result))
def test_socketfile_failure_filetype(self): self.fs.CreateFile('/tmp/not_socket', contents='testing') args = ('--status', 'running', '--connection', '/tmp/not_socket') result = check_docker.process_args(args=args) self.assertTrue(check_docker.socketfile_permissions_failure(parsed_args=result))
def test_args_timeout(self): args = ('--timeout', '9999') result = check_docker.process_args(args=args) self.assertEqual(result.timeout, 9999.0)
def test_args_containers(self): args = ('--containers', 'non-default') result = check_docker.process_args(args=args) self.assertListEqual(result.containers, ['non-default'])
def test_args_memory(self): args = ('--memory', 'non-default') result = check_docker.process_args(args=args) self.assertEqual(result.memory, 'non-default')
def test_missing_check(self): args = tuple() result = check_docker.process_args(args=args) self.assertTrue(check_docker.no_checks_present(result))
def test_socketfile_failure_unreadable(self): self.fs.CreateFile('/tmp/unreadable', contents='', st_mode=(stat.S_IFSOCK | 0o000)) args = ('--status', 'running', '--connection', '/tmp/unreadable') result = check_docker.process_args(args=args) self.assertTrue(check_docker.socketfile_permissions_failure(parsed_args=result))
def test_present_check(self): args = ('--status', 'running') result = check_docker.process_args(args=args) self.assertFalse(check_docker.no_checks_present(result))
def test_args_restart(self): args = ('--restarts', 'non-default') result = check_docker.process_args(args=args) self.assertEqual(result.restarts, 'non-default')