def testDockerRunning(self): args = self.parser.parse_args(self.COMMON_ARGS) cmd = dev.Dev(None, None) self.mock_run.side_effect = subprocess.CalledProcessError(returncode=1, cmd='') with self.assertRaises(dev.RuntimeMissingDependencyError): cmd.Run(args)
def testNoDocker(self): self.find_executable_on_path.return_value = False args = self.parser.parse_args(self.COMMON_ARGS) cmd = dev.Dev(None, None) with self.assertRaises(dev.RuntimeMissingDependencyError): cmd.Run(args)
def testSelectKind(self): args = self.parser.parse_args(['--kind-cluster=fake-cluster'] + self.COMMON_ARGS) cmd = dev.Dev(None, None) with mock.patch.object(kubernetes, 'KindClusterContext') as mock_kind: cmd.Run(args) mock_kind.assert_called()
def testSelectMinikube(self): args = self.parser.parse_args(['--minikube-profile=fake-profile'] + self.COMMON_ARGS) cmd = dev.Dev(None, None) with mock.patch.object(kubernetes, 'Minikube') as mock_minikube: cmd.Run(args) mock_minikube.assert_called()
def testSelectExternal(self): args = self.parser.parse_args(['--kube-context=context'] + self.COMMON_ARGS) cmd = dev.Dev(None, None) with mock.patch.object(kubernetes, 'ExternalClusterContext') as mock_cluster: cmd.Run(args) mock_cluster.assert_called()
def testSelectMinikubeDefaultOnMac(self): args = self.parser.parse_args(self.COMMON_ARGS) cmd = dev.Dev(None, None) with mock.patch.object(kubernetes, 'Minikube') as mock_minikube: with mock.patch.object(platforms.OperatingSystem, 'Current') as mock_current: mock_current.return_value = platforms.OperatingSystem.MACOSX cmd.Run(args) mock_minikube.assert_called()