PocketIc Test - call to canister_info fails. CanisterInfo SubnetNotFound

I’m calling update method using pocketIc.
The update method internally calls canister_info
Here is the brief code of test.


    let pocket_ic = PocketIcBuilder::new()

Here is the brief code inside my update method. Here I check for canister_response.0.controllers and compare them to one of my expected values for further processing.

    match canister_info(CanisterInfoRequest {
        num_requested_changes: None,
        Ok(canister_response) => {
// check canister_response.0.controllers
        Err(error) => {}

Here it fails when called from pocket_ic integration test. With below error.

DestinationInvalid : Unable to route management canister request canister_info: SubnetNotFound(CanisterId(2syes-usqll-dfpna-aiuxj-milj3-czoql-2wr3g-oy5nk-f6fvk-wvej2-mae), CanisterInfo)

How do I enable pocket ic to call canister_info from management canister?
Do i need to load management canister from wasm? If so, where to download from?
Is there any better way to run/test this in integration tests?


In the error message, I see


which is not a canister ID, but rather a user ID. So you’re calling canister_info on a user ID which causes the failure.

How do I enable pocket ic to call canister_info from management canister?

It is enabled by default, no specific action is needed. Please note that canister_info can only be invoked as an inter-canister call (not via an ingress message).


Thanks @mraszyk for pointing out the issue.

With my call to canister_info I was not passing canister id! I was passing user principal which was causing the issue.