mirror of
https://github.com/mumble-voip/grumble.git
synced 2025-12-21 18:41:56 -08:00
Minor features for parity with murmur.ini
MaxUsers: modifies existing sessionpool similar to Murmur MaxUsersPerChannel: already implemented, inconsistent name AllowPing: affects registration, too DefaultChannel RememberChannel ServerPassword SendOSInfo: already implemented, inconsistent name Config keys are renamed to conform to murmur.ini
This commit is contained in:
parent
693dd6f4e8
commit
ae41a612ba
12 changed files with 241 additions and 109 deletions
|
|
@ -6,35 +6,41 @@ import (
|
|||
)
|
||||
|
||||
func TestReclaim(t *testing.T) {
|
||||
pool := New()
|
||||
id := pool.Get()
|
||||
pool := New(2)
|
||||
id, err := pool.Get()
|
||||
if err != nil {
|
||||
t.Errorf("Expected no error: %v", err)
|
||||
}
|
||||
if id != 1 {
|
||||
t.Errorf("Got %v, expected 1 (first time)", id)
|
||||
}
|
||||
|
||||
pool.Reclaim(1)
|
||||
|
||||
id = pool.Get()
|
||||
id, err = pool.Get()
|
||||
if err != nil {
|
||||
t.Errorf("Expected no error: %v", err)
|
||||
}
|
||||
if id != 1 {
|
||||
t.Errorf("Got %v, expected 1 (second time)", id)
|
||||
}
|
||||
|
||||
id = pool.Get()
|
||||
id, err = pool.Get()
|
||||
if err != nil {
|
||||
t.Errorf("Expected no error: %v", err)
|
||||
}
|
||||
if id != 2 {
|
||||
t.Errorf("Got %v, expected 2", id)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDepletion(t *testing.T) {
|
||||
defer func() {
|
||||
r := recover()
|
||||
if r != "SessionPool depleted" {
|
||||
t.Errorf("Expected depletion panic")
|
||||
}
|
||||
}()
|
||||
pool := New()
|
||||
pool := New(0)
|
||||
pool.cur = math.MaxUint32
|
||||
pool.Get()
|
||||
_, err := pool.Get()
|
||||
if err == nil {
|
||||
t.Errorf("Expected depletion error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestUseTracking(t *testing.T) {
|
||||
|
|
@ -45,7 +51,7 @@ func TestUseTracking(t *testing.T) {
|
|||
}
|
||||
}()
|
||||
|
||||
pool := New()
|
||||
pool := New(0)
|
||||
pool.EnableUseTracking()
|
||||
pool.Reclaim(42)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue