MCPcopy
hub / github.com/unkeyed/unkey / createVerifications

Function createVerifications

pkg/clickhouse/billable_usage_test.go:211–230  ·  view source on GitHub ↗

Helper functions to create test data

(workspaceID string, count int, timestamp time.Time, outcome string)

Source from the content-addressed store, hash-verified

209// Helper functions to create test data
210
211func createVerifications(workspaceID string, count int, timestamp time.Time, outcome string) []schema.KeyVerification {
212 verifications := make([]schema.KeyVerification, count)
213 for i := range count {
214 verifications[i] = schema.KeyVerification{
215 RequestID: uid.New(uid.RequestPrefix),
216 Time: timestamp.Add(time.Duration(i) * time.Second).UnixMilli(),
217 WorkspaceID: workspaceID,
218 KeySpaceID: uid.New(uid.KeySpacePrefix),
219 IdentityID: "",
220 ExternalID: "",
221 KeyID: uid.New(uid.KeyPrefix),
222 Region: "us-east-1",
223 Outcome: outcome,
224 Tags: []string{},
225 SpentCredits: 0,
226 Latency: rand.Float64() * 100,
227 }
228 }
229 return verifications
230}
231
232func createRatelimits(workspaceID string, count int, timestamp time.Time, passed bool) []schema.Ratelimit {
233 ratelimits := make([]schema.Ratelimit, count)

Callers 1

Calls 4

NewFunction · 0.92
Float64Method · 0.80
AddMethod · 0.45
DurationMethod · 0.45

Tested by

no test coverage detected