Exemplo n.º 1
0
def _IsMinikubeClusterUp(cluster_name):
    """Checks if a minikube cluster is running."""
    cmd = [_FindMinikube(), 'status', '-p', cluster_name, '-o', 'json']
    try:
        status = run_subprocess.GetOutputJson(cmd, show_stderr=False)
        return 'Host' in status and status['Host'].strip() == 'Running'
    except ValueError:
        return False
Exemplo n.º 2
0
 def testCanHideStderr(self):
     # The JSON decode will fail either way. The point of this (flimsy) test is
     # to see if stderr is suppressed. I'll try to eliminate that feature
     # in an upcoming CL.
     with self.assertRaises(ValueError):
         run_subprocess.GetOutputJson(
             ['bash', '-c', 'echo should not see this in test log >&2'],
             timeout_sec=10,
             show_stderr=False)
Exemplo n.º 3
0
 def testErrorsOnInvalidJson(self):
     with self.assertRaises(ValueError):
         run_subprocess.GetOutputJson(['echo', '{corruptjson'],
                                      timeout_sec=10)
Exemplo n.º 4
0
 def testReturnsParsedCommandJson(self):
     parsed = run_subprocess.GetOutputJson(['echo', '{"hello": "world"}'],
                                           timeout_sec=10)
     self.assertEqual(parsed, {u'hello': u'world'})