fix: cmd/glab tests fail under goleak

Description

TestGlab runs the real main() against the developer's live config. On a Linux desktop with a session bus, resolving the token for the checkout's host reaches zalando/go-keyring, which opens a shared dbus.SessionBus() connection whose reader goroutine can't be closed, so goleak.VerifyTestMain fails the package after every test passes.

Make the test hermetic:

  • Point GLAB_CONFIG_DIR at a temp dir so no hosts: entry exists and the test never reads the developer's config.
  • Mock the keyring (keyring.MockInit + t.Cleanup) so the test can never reach D-Bus even if a future code path reads the keyring without a host entry. Same pattern as internal/commands/auth/docker/helper_refresh_test.go.

Linter drops //nolint:unparam since t is now used.

Resolves #8519 (closed)

How has this been tested?

go test ./cmd/glab/ should no longer replicate the goleak issue

Screenshots (if appropriate):

Edited by Syed Saif Ali Alvi

Merge request reports

Loading
Loading