clusterdiscovery: fix login-hint tests for squashed login-server list · Entire
clusterdiscovery: fix login-hint tests for squashed login-server list
2ec7df5→main·toothbrush·1mo ago·3 files·+14 added/-11 removed
d471460 squashed the advertised login-server list and entire auth use hint out of renderLoginHint (until the multi-login UX is ready) but left two tests asserting the old richer message, breaking test-core CI:
TestRenderLoginHint and TestResolve_NoEligibleContextReturnsLoginHint.
Update both to assert the new message (and that the URLs / auth-use hint are intentionally absent), and refresh the stale RenderLoginHint doc comment that still claimed "one indented URL per line".
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Sessions
c088e375b2f5View transcript
Changes
3
internal/entireclient/clusterdiscovery
Mdiscovery.go+4/-4
Mdiscovery_test.go+6/-5
Mresolve_test.go+4/-2
135 unmodified lines
// RenderLoginHint formats a fatal-ready message describing which
// entire-core URLs an operator can log into to gain credentials for
// clusterHost. The output is stable (one indented URL per line) so
// callers can pattern-match in tests.
// RenderLoginHint formats a fatal-ready "no auth context for cluster X"
// message telling the operator to run entire login. coreURLs (the cluster's
// advertised login servers) is accepted but intentionally not yet surfaced —
// see renderLoginHint.
func RenderLoginHint(clusterHost string, coreURLs []string) string {
return renderLoginHint("cluster "+clusterHost, coreURLs)
}
Minternal/entireclient/clusterdiscovery/discovery.go+4/-4
125 unmodified lines
func TestRenderLoginHint(t *testing.T) {
hint := RenderLoginHint("rc.partial.to", []string{"https://a.example", "https://b.example"})
// Each URL is on its own indented line — the "bog-simple stdout
// list" requirement.
assert.Contains(t, hint, "no auth context for cluster rc.partial.to")
assert.Contains(t, hint, "\n https://a.example\n", "missing indented URL line: %q", hint)
assert.Contains(t, hint, "\n https://b.example\n", "missing indented URL line: %q", hint)
assert.Contains(t, hint, "entire login")
assert.Contains(t, hint, "entire auth use")
// The advertised login servers are intentionally squashed from the hint
// until the multi-login UX is ready (see renderLoginHint): the coreURLs
// argument is accepted but not yet surfaced, so neither the URLs nor the
// `entire auth use` switch hint appear.
assert.NotContains(t, hint, "https://a.example", "login servers should be squashed for now: %q", hint)
assert.NotContains(t, hint, "entire auth use", "auth-use hint should be squashed for now: %q", hint)
}
Minternal/entireclient/clusterdiscovery/discovery_test.go+6/-5
118 unmodified lines
_, err := ResolveContextForCluster(t.Context(), configDir, t.TempDir(), "aws-eu-central-1.entire.io", hostPinningClient(t, srv), t.Logf)
require.Error(t, err)
assert.Contains(t, err.Error(), "no auth context for cluster aws-eu-central-1.entire.io")
assert.Contains(t, err.Error(), "https://eu.auth.entire.io")
assert.Contains(t, err.Error(), "entire login")
assert.Contains(t, err.Error(), "entire auth use")
// Advertised login servers + the entire auth use hint are intentionally
// squashed for now (see renderLoginHint).
assert.NotContains(t, err.Error(), "https://eu.auth.entire.io")
assert.NotContains(t, err.Error(), "entire auth use")
}
// TestResolve_CoresCachedAcrossCalls: the first call hits /.well-known and
Minternal/entireclient/clusterdiscovery/resolve_test.go+4/-2