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
115aae7c34
commit
dcb2b23a7d
1 changed files with 16 additions and 0 deletions
|
@ -19,6 +19,7 @@ const (
|
|||
|
||||
var (
|
||||
errTest = errors.New("mock")
|
||||
errWrongTag = errors.New("wrong tag")
|
||||
errResExhausted *apistatus.ResourceExhausted
|
||||
)
|
||||
|
||||
|
@ -119,3 +120,18 @@ func Test_MaxActiveRPCLimiter(t *testing.T) {
|
|||
require.True(t, lim.released)
|
||||
})
|
||||
}
|
||||
|
||||
func TestSetCriticalIOTagUnaryServerInterceptor_Pass(t *testing.T) {
|
||||
interceptor := qos.NewSetCriticalIOTagUnaryServerInterceptor()
|
||||
called := false
|
||||
handler := func(ctx context.Context, req any) (any, error) {
|
||||
called = true
|
||||
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)
|
||||
require.True(t, called)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue