forked from TrueCloudLab/frostfs-qos
[#14] mclock: Allow to prohibit tag requests
It is now possible to restrict requests for a specific tag. A separate field in `TagInfo` is used to avoid comparing float64 values with zero. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
57d895c321
commit
6c6e5bf4de
2 changed files with 24 additions and 0 deletions
|
@ -563,3 +563,22 @@ func TestMClockLimitTotalTime(t *testing.T) {
|
|||
require.True(t, time.Since(startedAt) >= 1500*time.Millisecond)
|
||||
require.True(t, time.Since(startedAt) <= 1600*time.Millisecond) // 100 ms offset to complete all requests
|
||||
}
|
||||
|
||||
func TestMClockRestictTagRequests(t *testing.T) {
|
||||
t.Parallel()
|
||||
limit := 10.0
|
||||
q, err := NewMClock(100, 100, map[string]TagInfo{
|
||||
"class1": {Share: 50, LimitIOPS: &limit},
|
||||
"class2": {Share: 50, LimitIOPS: &limit, Prohibited: true},
|
||||
}, 5*time.Second)
|
||||
require.NoError(t, err)
|
||||
defer q.Close()
|
||||
|
||||
release, err := q.RequestArrival(context.Background(), "class1")
|
||||
require.NoError(t, err)
|
||||
release()
|
||||
|
||||
release, err = q.RequestArrival(context.Background(), "class2")
|
||||
require.ErrorIs(t, err, ErrTagRequestsProhibited)
|
||||
require.Nil(t, release)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue