Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
jost-s committed Aug 30, 2024
1 parent 4ed5477 commit f3eeef7
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
5 changes: 1 addition & 4 deletions src/admin_websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,7 @@ impl AdminWebsocket {
}
}


pub async fn list_cell_ids(
&self,
) -> ConductorApiResult<Vec<CellId>> {
pub async fn list_cell_ids(&self) -> ConductorApiResult<Vec<CellId>> {
let response = self.send(AdminRequest::ListCellIds).await?;
match response {
AdminResponse::CellIdsListed(cell_ids) => Ok(cell_ids),
Expand Down
35 changes: 35 additions & 0 deletions tests/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,3 +296,38 @@ async fn agent_info() {
assert_eq!(agent_infos.len(), 3);
assert!(agent_infos.contains(&other_agent));
}

#[tokio::test(flavor = "multi_thread")]
async fn list_cell_ids() {
let conductor = SweetConductor::from_standard_config().await;
let admin_port = conductor.get_arbitrary_admin_websocket_port().unwrap();
let admin_ws = AdminWebsocket::connect(format!("127.0.0.1:{}", admin_port))
.await
.unwrap();
let app_id: InstalledAppId = "test-app".into();
let agent_key = admin_ws.generate_agent_pub_key().await.unwrap();
let app_info = admin_ws
.install_app(InstallAppPayload {
agent_key: Some(agent_key),
installed_app_id: Some(app_id.clone()),
existing_cells: HashMap::new(),
membrane_proofs: Some(HashMap::new()),
network_seed: None,
source: AppBundleSource::Path(PathBuf::from("./fixture/test.happ")),
ignore_genesis_failure: false,
})
.await
.unwrap();
admin_ws.enable_app(app_id).await.unwrap();
let cell_id =
if let CellInfo::Provisioned(cell) = &app_info.cell_info.get(ROLE_NAME).unwrap()[0] {
cell.cell_id.clone()
} else {
panic!("expected provisioned cell");
};

let cell_ids = admin_ws.list_cell_ids().await.unwrap();
// Check if list includes cell id. Not checking for equality to a vector of just the one cell id,
// because the DPKI cell is included too.
assert!(cell_ids.contains(&cell_id));
}

0 comments on commit f3eeef7

Please sign in to comment.