forked from TrueCloudLab/frostfs-node
[#1656] qos: Add test for SetCriticalIOTag
Interceptor
Change-Id: I4a55fcb84e6f65408a1c0120ac917e49e23354a1 Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
This commit is contained in:
parent
c16788f9c6
commit
99340b2717
1 changed files with 13 additions and 0 deletions
|
@ -19,6 +19,7 @@ const (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
errTest = errors.New("mock")
|
errTest = errors.New("mock")
|
||||||
|
errWrongTag = errors.New("wrong tag")
|
||||||
errResExhausted = new(apistatus.ResourceExhausted)
|
errResExhausted = new(apistatus.ResourceExhausted)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -117,3 +118,15 @@ func Test_MaxActiveRPCLimiter(t *testing.T) {
|
||||||
require.True(t, called && lim.released)
|
require.True(t, called && lim.released)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSetCriticalIOTagUnaryServerInterceptor_Pass(t *testing.T) {
|
||||||
|
interceptor := qos.NewSetCriticalIOTagUnaryServerInterceptor()
|
||||||
|
handler := func(ctx context.Context, req any) (any, error) {
|
||||||
|
if tag, ok := tagging.IOTagFromContext(ctx); ok && tag == qos.IOTagCritical.String() {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return nil, errWrongTag
|
||||||
|
}
|
||||||
|
_, err := interceptor(context.Background(), nil, nil, handler)
|
||||||
|
require.NoError(t, err)
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue