diff --git a/internal/qos/grpc_test.go b/internal/qos/grpc_test.go index d6e2a689c..d4030c39e 100644 --- a/internal/qos/grpc_test.go +++ b/internal/qos/grpc_test.go @@ -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) +}