def testFallsBackToUsingShellPath(self): with mock.patch.object(config, 'Paths') as mock_paths: mock_paths.return_value.sdk_root = os.path.join( 'some', 'sdk', 'root') with mock.patch.object(update_manager.UpdateManager, 'EnsureInstalledAndRestart') as mock_ensure: mock_ensure.return_value = False found = run_subprocess.GetGcloudPreferredExecutable('echo') # Path will be like /usr/buildtools/buildhelpers/v4/bin/echo' or # '.../bin/echo.exe'. self.assertIn(os.path.join('bin', 'echo'), found)
def testPrefersGcloudComponent(self): with mock.patch.object(config, 'Paths') as mock_paths: mock_paths.return_value.sdk_root = os.path.join( 'some', 'sdk', 'root') with mock.patch.object(update_manager.UpdateManager, 'EnsureInstalledAndRestart') as mock_ensure: mock_ensure.return_value = True found = run_subprocess.GetGcloudPreferredExecutable('echo') self.assertEqual(mock_ensure.call_args, mock.call(['echo'])) self.assertEqual(found, os.path.join('some', 'sdk', 'root', 'bin', 'echo'))
def _FindKubectl(): return run_subprocess.GetGcloudPreferredExecutable('kubectl')
def _FindMinikube(): return run_subprocess.GetGcloudPreferredExecutable('minikube')
def _FindKind(): """Finds a path to kind.""" return run_subprocess.GetGcloudPreferredExecutable('kind')
def _FindMinikube(): return (properties.VALUES.code.minikube_path_override.Get() or run_subprocess.GetGcloudPreferredExecutable('minikube'))