From 33bca15ec97b26ee928d06a47ca51ff5f42fe945 Mon Sep 17 00:00:00 2001 From: James MacMahon Date: Thu, 14 Dec 2023 12:27:50 -0500 Subject: [PATCH] handle instance rename in test --- nexus/tests/integration_tests/disks.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/nexus/tests/integration_tests/disks.rs b/nexus/tests/integration_tests/disks.rs index a0c8241ca6..a7c9c99509 100644 --- a/nexus/tests/integration_tests/disks.rs +++ b/nexus/tests/integration_tests/disks.rs @@ -1271,6 +1271,7 @@ async fn test_disk_virtual_provisioning_collection_failed_delete( }, size: disk_size, }; + NexusRequest::new( RequestBuilder::new(client, Method::POST, &disks_url) .body(Some(&disk_one)) @@ -1281,6 +1282,11 @@ async fn test_disk_virtual_provisioning_collection_failed_delete( .await .expect("unexpected failure creating 1 GiB disk"); + // Get the disk + let disk_url = format!("/v1/disks/{}?project={}", "disk-one", PROJECT_NAME); + let disk = disk_get(&client, &disk_url).await; + assert_eq!(disk.state, DiskState::Detached); + // Assert correct virtual provisioning collection numbers let virtual_provisioning_collection = datastore .virtual_provisioning_collection_get(&opctx, project_id1) @@ -1302,8 +1308,6 @@ async fn test_disk_virtual_provisioning_collection_failed_delete( .await; // Delete the disk - expect this to fail - let disk_url = format!("/v1/disks/{}?project={}", "disk-one", PROJECT_NAME); - NexusRequest::new( RequestBuilder::new(client, Method::DELETE, &disk_url) .expect_status(Some(StatusCode::INTERNAL_SERVER_ERROR)), @@ -1323,7 +1327,12 @@ async fn test_disk_virtual_provisioning_collection_failed_delete( disk_size ); - // And the disk is now faulted + // And the disk is now faulted. The name will have changed due to the + // "undelete and fault" function. + let disk_url = format!( + "/v1/disks/deleted-{}?project={}", + disk.identity.id, PROJECT_NAME + ); let disk = disk_get(&client, &disk_url).await; assert_eq!(disk.state, DiskState::Faulted);