Example #1
0
    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)
Example #2
0
    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)
Example #3
0
    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()
Example #4
0
    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()
Example #5
0
    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()
Example #6
0
    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()