MCPcopy Create free account
hub / github.com/PostHog/duckgres / TestBackendKeyGeneration

Function TestBackendKeyGeneration

server/parent_test.go:248–263  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

246 }
247 if ExitAuthFailure != 10 {
248 t.Errorf("ExitAuthFailure should be 10, got %d", ExitAuthFailure)
249 }
250}
251
252func TestBackendKeyGeneration(t *testing.T) {
253 // Generate multiple keys and verify they're different (high probability)
254 keys := make(map[int32]bool)
255 for i := 0; i < 100; i++ {
256 key := generateSecretKey()
257 if key == 0 {
258 t.Error("Generated secret key should not be 0")
259 }
260 keys[key] = true
261 }
262
263 // With good randomness, we should have close to 100 unique keys
264 if len(keys) < 90 {
265 t.Errorf("Expected mostly unique keys, got only %d unique out of 100", len(keys))
266 }

Callers

nothing calls this directly

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected