[App] Fix hanging CI (#15913)
This commit is contained in:
parent
32cf1faa07
commit
ab022ac60f
|
@ -56,7 +56,6 @@ def _find_cluster_for_user(app_name: str, cluster_id: Optional[str]) -> str:
|
||||||
valid_cluster_list.append(cluster.id)
|
valid_cluster_list.append(cluster.id)
|
||||||
if cluster.spec.cluster_type == V1ClusterType.GLOBAL and default_cluster is None:
|
if cluster.spec.cluster_type == V1ClusterType.GLOBAL and default_cluster is None:
|
||||||
default_cluster = cluster.id
|
default_cluster = cluster.id
|
||||||
break
|
|
||||||
|
|
||||||
# when no cluster-id is passed in, use the default (Lightning Cloud) cluster
|
# when no cluster-id is passed in, use the default (Lightning Cloud) cluster
|
||||||
if cluster_id is None:
|
if cluster_id is None:
|
||||||
|
|
|
@ -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.")
|
@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):
|
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(
|
Externalv1Cluster(
|
||||||
id="default",
|
id="default",
|
||||||
spec=V1ClusterSpec(
|
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.")
|
@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):
|
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(
|
Externalv1Cluster(
|
||||||
id="default",
|
id="default",
|
||||||
spec=V1ClusterSpec(
|
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.")
|
@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")
|
@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(
|
def test_find_cluster_for_user_without_valid_cluster_id_asks_if_they_meant_to_use_valid(
|
||||||
list_clusters_mock: mock.MagicMock,
|
list_clusters_mock: mock.MagicMock,
|
||||||
inquirer_mock: mock.MagicMock,
|
inquirer_mock: mock.MagicMock,
|
||||||
):
|
):
|
||||||
list_clusters_mock.return_value = [
|
list_clusters_mock.return_value.clusters = [
|
||||||
Externalv1Cluster(
|
Externalv1Cluster(
|
||||||
id="default",
|
id="default",
|
||||||
spec=V1ClusterSpec(
|
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.")
|
@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")
|
@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):
|
def test_app_find_selected_app_instance_id_when_app_name_exists(list_apps_mock: mock.MagicMock):
|
||||||
list_apps_mock.return_value = [
|
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.")
|
@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")
|
@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):
|
def test_app_find_selected_app_instance_id_when_app_id_exists(list_apps_mock: mock.MagicMock):
|
||||||
list_apps_mock.return_value = [
|
list_apps_mock.return_value = [
|
||||||
|
|
Loading…
Reference in New Issue