-
Notifications
You must be signed in to change notification settings - Fork 89
Expand file tree
/
Copy pathassociation_interleaving_options_test.go
More file actions
38 lines (29 loc) · 1.16 KB
/
Copy pathassociation_interleaving_options_test.go
File metadata and controls
38 lines (29 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// SPDX-FileCopyrightText: 2026 The Pion community <https://pion.ly>
// SPDX-License-Identifier: MIT
package sctp
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestInterleavingSettingsWeightedFairQueueingFactorySnapshotsWeights(t *testing.T) {
settings := &interleavingSettings{}
assert.NoError(t, WithInterleavingWeightedFairQueueingWeight(1, 2)(settings))
settings.wfqWeights[1] = 5
scheduler, ok := settings.newStreamScheduler().(*weightedFairQueueingPendingQueuePolicy)
if !assert.True(t, ok) {
return
}
assert.Equal(t, map[uint16]uint16{1: 2}, scheduler.weights)
}
func TestCloneInterleavingSettingsWeightedFairQueueingFactoryUsesClonedWeights(t *testing.T) {
settings := &interleavingSettings{}
assert.NoError(t, WithInterleavingWeightedFairQueueingWeight(1, 2)(settings))
clone := cloneInterleavingSettings(settings)
assert.NoError(t, WithInterleavingWeightedFairQueueingWeight(1, 5)(settings))
scheduler, ok := clone.newStreamScheduler().(*weightedFairQueueingPendingQueuePolicy)
if !assert.True(t, ok) {
return
}
assert.Equal(t, map[uint16]uint16{1: 2}, clone.wfqWeights)
assert.Equal(t, map[uint16]uint16{1: 2}, scheduler.weights)
}