MCPcopy Create free account
hub / github.com/bytebase/bytebase / TestIsUnifiedInstanceLimit

Function TestIsUnifiedInstanceLimit

backend/enterprise/license_test.go:24–45  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

22}
23
24func TestIsUnifiedInstanceLimit(t *testing.T) {
25 tests := []struct {
26 name string
27 instanceLimit int
28 activatedLimit int
29 want bool
30 }{
31 {name: "equal finite caps", instanceLimit: 10, activatedLimit: 10, want: true},
32 {name: "activated cap larger than registration cap", instanceLimit: 10, activatedLimit: 20, want: true},
33 {name: "split cap", instanceLimit: 50, activatedLimit: 20, want: false},
34 {name: "unlimited both sides", instanceLimit: math.MaxInt, activatedLimit: math.MaxInt, want: true},
35 {name: "unlimited registration finite activation", instanceLimit: math.MaxInt, activatedLimit: 20, want: false},
36 {name: "finite registration unlimited activation", instanceLimit: 20, activatedLimit: math.MaxInt, want: true},
37 }
38 for _, tt := range tests {
39 t.Run(tt.name, func(t *testing.T) {
40 if got := isUnifiedInstanceLimit(tt.instanceLimit, tt.activatedLimit); got != tt.want {
41 t.Fatalf("isUnifiedInstanceLimit(%d, %d) = %v, want %v", tt.instanceLimit, tt.activatedLimit, got, tt.want)
42 }
43 })
44 }
45}
46
47func TestIsFeatureEnabledForInstanceUnifiedLicense(t *testing.T) {
48 ctx := context.Background()

Callers

nothing calls this directly

Calls 3

isUnifiedInstanceLimitFunction · 0.85
FatalfMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected