Getwalletinfo returned an uninitialized value for unlocked_until before the first walletpassphrase call, even though the wallet was locked and it should return 0.
I'm not a fan of the assertion being time dependent. If for some reason the dumpprivkey rpc lasts more than a second the test will fail.
Yes, this needs to be reworked. Timing dependent assertions are to be avoided, especially since there are time mocking capabilities.
It would also be worth looking at what core does and backport that if they already fixed it.