Ejemplo n.º 1
0
    def testStepNoSteps(self):
        event = {"type": "io.k8s.sigs.minikube.step", "data": {}}

        progress_bar = mock.MagicMock()
        set_progress = progress_bar.SetProgress
        kubernetes._HandleMinikubeStatusEvent(progress_bar, event)
        set_progress.assert_not_called()
Ejemplo n.º 2
0
 def testNonExitErrors(self):
     event = {
         "type": "io.k8s.sigs.minikube.error",
         "data": {
             "message": "Blah blah blah.\n",
         }
     }
     # No exception means pass.
     kubernetes._HandleMinikubeStatusEvent(mock.Mock(), event)
Ejemplo n.º 3
0
 def testOtherError(self):
     event = {
         "type": "io.k8s.sigs.minikube.error",
         "data": {
             "message": "Blah blah blah.\n",
             "exitcode": "64"
         }
     }
     expected_error_message = "Unable to start Cloud Run Emulator."
     with self.assertRaisesRegex(kubernetes.MinikubeStartError,
                                 expected_error_message):
         kubernetes._HandleMinikubeStatusEvent(mock.Mock(), event)
Ejemplo n.º 4
0
 def testDockerUnreachable(self):
     event = {
         "type": "io.k8s.sigs.minikube.error",
         "data": {
             "exitcode": "69",
             "message": "blah blah blah",
         }
     }
     expected_error_message = "Cannot reach docker daemon."
     with self.assertRaisesRegex(kubernetes.MinikubeStartError,
                                 expected_error_message):
         kubernetes._HandleMinikubeStatusEvent(mock.Mock(), event)
Ejemplo n.º 5
0
    def testHostPermissionsError(self):
        event = {
            "type": "io.k8s.sigs.minikube.error",
            "data": {
                "id": "HOST_HOME_PERMISSION",
                "advice": "Do something.",
                "exitcode": "37"
            }
        }

        with self.assertRaisesRegex(kubernetes.MinikubeStartError,
                                    "Do something."):
            kubernetes._HandleMinikubeStatusEvent(mock.Mock(), event)
Ejemplo n.º 6
0
 def testNotEnoughCpuErrorMacOrWindows(self):
     event = {
         "type": "io.k8s.sigs.minikube.error",
         "data": {
             "message": "Ensure your  system has enough CPUs. The minimum "
             "allowed is 2 CPUs.\n",
             "exitcode": "29"
         }
     }
     expected_error_message = (
         "Not enough CPUs. Cloud Run Emulator requires "
         "2 CPUs. Increase Docker VM CPUs to 2.")
     with self.assertRaisesRegex(kubernetes.MinikubeStartError,
                                 expected_error_message):
         kubernetes._HandleMinikubeStatusEvent(mock.Mock(), event)
Ejemplo n.º 7
0
    def testDownloadNoSteps(self):
        event = {"type": "io.k8s.sigs.minikube.download.progress", "data": {}}

        progress_bar = mock.MagicMock()
        kubernetes._HandleMinikubeStatusEvent(progress_bar, event)
        progress_bar.SetProgress.assert_not_called()