mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 08:23:45 +00:00
feat(multiplayer): add shared allocation quota
This commit is contained in:
@@ -21,6 +21,29 @@ func TestAllocatorSQLClaimsAndAuditsCompatibleReadyServers(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, fragment := range []string{"allocation_quotas", "ON CONFLICT (region)", "used_allocations"} {
|
||||
if !contains(SetAllocationQuotaSQL, fragment) {
|
||||
t.Fatalf("quota query missing %q", fragment)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetAllocationQuotaRejectsInvalidArgumentsWithoutDatabase(t *testing.T) {
|
||||
if err := SetAllocationQuota(nil, nil, "EU", 1, time.Minute, time.Unix(1000, 0)); err == nil {
|
||||
t.Fatal("nil database accepted")
|
||||
}
|
||||
if err := SetAllocationQuota(nil, nil, "APAC", 1, time.Minute, time.Unix(1000, 0)); err == nil {
|
||||
t.Fatal("unknown region accepted")
|
||||
}
|
||||
if err := SetAllocationQuota(nil, nil, "EU", 0, time.Minute, time.Unix(1000, 0)); err == nil {
|
||||
t.Fatal("zero limit accepted")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAllocationQuotaConsumeRejectsInvalidArgumentsWithoutDatabase(t *testing.T) {
|
||||
if err := (AllocationQuota{}).Consume(nil, "EU", time.Unix(1000, 0)); err == nil {
|
||||
t.Fatal("nil database accepted")
|
||||
}
|
||||
}
|
||||
|
||||
func TestClaimAllocationRejectsInvalidRequestsWithoutDatabase(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user