This bug is difficult to reproduce locally, but easy to reproduce in CI.
It was originally revealed in this PR, but it cannot be directly related to the changes there. We think it might be a timing issue (with this PR, the certificate is loaded via ca-certificates which might be slower).
The test code to reveal the bug is:
- Call FetchJwtToken
- Monitor D-Bus waiting for event JwtTokenStateChange
- Call GetJwtToken
The error message is:
See this commit commenting out the problematic part.
- The issue is fixed
- The second part of test_dbus_fetch_jwt_token is uncommented and executed in CI