# Pocket-ic support for management canister calls and timers?

**URL:** <https://forum.dfinity.org/t/pocket-ic-support-for-management-canister-calls-and-timers/25676>\
**Category:** Developers\
**Created:** [December 18, 2023, 12:19pm UTC](https://forum.dfinity.org/t/pocket-ic-support-for-management-canister-calls-and-timers/25676 "2023-12-18T12:19:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kristofer](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/kristofer/32/11135_2.png) [@kristofer](https://forum.dfinity.org/u/kristofer)\
**Post date:** [December 18, 2023, 12:19pm UTC](https://forum.dfinity.org/t/pocket-ic-support-for-management-canister-calls-and-timers/25676/1 "2023-12-18T12:19:52Z")

</div>

In the `init()` of a canister, I set up a random number generator, like this:

```Rust
    ic_cdk_timers::set_timer(Duration::ZERO, || {
        ic_cdk::spawn(async {
            let (seed,): ([u8; 32],) =
                ic_cdk::call(Principal::management_canister(), "raw_rand", ())
                    .await
                    .unwrap();
            RNG.with_borrow_mut(|rng| *rng = Some(ChaCha20Rng::from_seed(seed)));
        })
    });

```

Now I want to test this canister using pocket-ic. RNG don’t seem to be initialized though. Is it the case that pocket-ic doesn’t support timers and/or management canister calls?

@michael-weigelt

---

<div class="post-metadata">

**Author:** ![mraszyk](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/mraszyk/32/7945_2.png) [@mraszyk](https://forum.dfinity.org/u/mraszyk)\
**Post date:** [December 18, 2023, 12:35pm UTC](https://forum.dfinity.org/t/pocket-ic-support-for-management-canister-calls-and-timers/25676/2 "2023-12-18T12:35:23Z")

</div>

PocketIC supports timer and mgmt canister calls, but you need to call tick() a few times to see the effects (on the IC mainnet, it’d also take a few rounds of execution to see the effects). In case, the timer has a positive duration, you might also need to advance time on PocketIC to trigger the timer.

---

<div class="post-metadata">

**Author:** ![gravity\_vi](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/gravity_vi/32/35810_2.png) [@gravity\_vi](https://forum.dfinity.org/u/gravity_vi)\
**Post date:** [January 15, 2024, 9:15am UTC](https://forum.dfinity.org/t/pocket-ic-support-for-management-canister-calls-and-timers/25676/3 "2024-01-15T09:15:33Z")

</div>

We are facing kind of similar issue with pocket\_ic. Does anyone have an idea how to resolve this?

> [@PocketIC: Testing Canisters in Python snake](https://forum.dfinity.org/t/pocketic-testing-canisters-in-python/22490/2):
>
> We are facing an issue with pocket\_ic. In our scenario a user\_index canister manages all canister for users. And when the upgrades run for user\_index canister it also upgrades all the individual user canisters in post\_upgrade. Previously we used to use state\_machine to test this scenario and one call to tick command with advance\_time used to upgrade user\_index and all individual canisters. With the recent move to pocket\_ic tick call is not upgrading all the canisters. Is there a way to determin…
