test: fix expires value in TestClear_WithRevoke_ActiveToken
Description
The test TestClear_WithRevoke_ActiveToken because of a missed .UTC() call.
To reproduce, mock time.Now() with the following now value:
loc = time.FixedZone("UTC-2", -2*60*60)
now = time.Date(2026, 1, 23, 23, 0, 0, 0, loc)
=== RUN TestClear_WithRevoke_ActiveToken
/Users/alexandear/src/gitlab.com/gitlab-org/cli/internal/commands/cluster/agent/token_cache/clear/clear_command_test.go:132:
Error Trace: /Users/alexandear/src/gitlab.com/gitlab-org/cli/internal/commands/cluster/agent/token_cache/clear/clear_command_test.go:132
Error: "Found 1 cached token(s) to clear.\nRevoking tokens on GitLab server...\nToken for agent 10 is expired, skipping revocation.\nClearing tokens from cache...\nCleared token for agent 10 from filesystem.\nSuccessfully cleared 1 token(s) from cache.\n" does not contain "Revoking token for agent 10"
Test: TestClear_WithRevoke_ActiveToken
/Users/alexandear/src/gitlab.com/gitlab-org/cli/internal/commands/cluster/agent/token_cache/clear/clear_command_test.go:133:
Error Trace: /Users/alexandear/src/gitlab.com/gitlab-org/cli/internal/commands/cluster/agent/token_cache/clear/clear_command_test.go:133
Error: "Found 1 cached token(s) to clear.\nRevoking tokens on GitLab server...\nToken for agent 10 is expired, skipping revocation.\nClearing tokens from cache...\nCleared token for agent 10 from filesystem.\nSuccessfully cleared 1 token(s) from cache.\n" does not contain "Successfully revoked token for agent 10"
Test: TestClear_WithRevoke_ActiveToken
/Users/alexandear/go/pkg/mod/go.uber.org/mock@v0.6.0/gomock/controller.go:97: missing call(s) to *testing.MockPersonalAccessTokensServiceInterface.RevokePersonalAccessTokenByID(is equal to 456 (int64), is anything) /Users/alexandear/src/gitlab.com/gitlab-org/cli/internal/commands/cluster/agent/token_cache/clear/clear_command_test.go:125
/Users/alexandear/go/pkg/mod/go.uber.org/mock@v0.6.0/gomock/controller.go:97: aborting test due to missing call(s)
--- FAIL: TestClear_WithRevoke_ActiveToken (0.00s)
Related Issues
Resolves #8131 (closed)
How has this been tested?
go test
Screenshots (if appropriate):
Edited by Oleksandr Redko