Skip to content

Commit

Permalink
handle instance rename in test
Browse files Browse the repository at this point in the history
  • Loading branch information
jmpesp committed Dec 14, 2023
1 parent 3f8bc50 commit 33bca15
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions nexus/tests/integration_tests/disks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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)
Expand All @@ -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)),
Expand All @@ -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);

Expand Down

0 comments on commit 33bca15

Please sign in to comment.