[App] Fix hanging CI (#15913)

This commit is contained in:
Ethan Harris 2022-12-06 00:21:44 +00:00 committed by GitHub
parent 32cf1faa07
commit ab022ac60f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 7 deletions

View File

@ -56,7 +56,6 @@ def _find_cluster_for_user(app_name: str, cluster_id: Optional[str]) -> str:
valid_cluster_list.append(cluster.id)
if cluster.spec.cluster_type == V1ClusterType.GLOBAL and default_cluster is None:
default_cluster = cluster.id
break
# when no cluster-id is passed in, use the default (Lightning Cloud) cluster
if cluster_id is None:

View File

@ -8,9 +8,10 @@ from lightning_app.cli.lightning_cli_delete import _find_cluster_for_user, _find
@pytest.mark.skipif(sys.platform == "win32", reason="currently not supported for windows.")
@mock.patch("lightning_app.cli.lightning_cli_delete.AWSClusterManager.list_clusters")
@mock.patch("lightning_cloud.login.Auth.authenticate", mock.MagicMock())
@mock.patch("lightning_app.utilities.network.LightningClient.cluster_service_list_clusters")
def test_find_cluster_for_user_when_provided_valid_cluster_id(list_clusters_mock: mock.MagicMock):
list_clusters_mock.return_value = [
list_clusters_mock.return_value.clusters = [
Externalv1Cluster(
id="default",
spec=V1ClusterSpec(
@ -29,9 +30,10 @@ def test_find_cluster_for_user_when_provided_valid_cluster_id(list_clusters_mock
@pytest.mark.skipif(sys.platform == "win32", reason="currently not supported for windows.")
@mock.patch("lightning_app.cli.lightning_cli_delete.AWSClusterManager.list_clusters")
@mock.patch("lightning_cloud.login.Auth.authenticate", mock.MagicMock())
@mock.patch("lightning_app.utilities.network.LightningClient.cluster_service_list_clusters")
def test_find_cluster_for_user_without_cluster_id_uses_default(list_clusters_mock: mock.MagicMock):
list_clusters_mock.return_value = [
list_clusters_mock.return_value.clusters = [
Externalv1Cluster(
id="default",
spec=V1ClusterSpec(
@ -44,13 +46,14 @@ def test_find_cluster_for_user_without_cluster_id_uses_default(list_clusters_moc
@pytest.mark.skipif(sys.platform == "win32", reason="currently not supported for windows.")
@mock.patch("lightning_app.cli.lightning_cli_delete.AWSClusterManager.list_clusters")
@mock.patch("lightning_cloud.login.Auth.authenticate", mock.MagicMock())
@mock.patch("lightning_app.utilities.network.LightningClient.cluster_service_list_clusters")
@mock.patch("lightning_app.cli.lightning_cli_delete.inquirer")
def test_find_cluster_for_user_without_valid_cluster_id_asks_if_they_meant_to_use_valid(
list_clusters_mock: mock.MagicMock,
inquirer_mock: mock.MagicMock,
):
list_clusters_mock.return_value = [
list_clusters_mock.return_value.clusters = [
Externalv1Cluster(
id="default",
spec=V1ClusterSpec(
@ -63,6 +66,7 @@ def test_find_cluster_for_user_without_valid_cluster_id_asks_if_they_meant_to_us
@pytest.mark.skipif(sys.platform == "win32", reason="currently not supported for windows.")
@mock.patch("lightning_cloud.login.Auth.authenticate", mock.MagicMock())
@mock.patch("lightning_app.cli.lightning_cli_delete._AppManager.list_apps")
def test_app_find_selected_app_instance_id_when_app_name_exists(list_apps_mock: mock.MagicMock):
list_apps_mock.return_value = [
@ -74,6 +78,7 @@ def test_app_find_selected_app_instance_id_when_app_name_exists(list_apps_mock:
@pytest.mark.skipif(sys.platform == "win32", reason="currently not supported for windows.")
@mock.patch("lightning_cloud.login.Auth.authenticate", mock.MagicMock())
@mock.patch("lightning_app.cli.lightning_cli_delete._AppManager.list_apps")
def test_app_find_selected_app_instance_id_when_app_id_exists(list_apps_mock: mock.MagicMock):
list_apps_mock.return_value = [