[#2] tagging: Add grpc and context methods
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
f4d8ebf13d
commit
1fb8b137c5
5 changed files with 190 additions and 1 deletions
23
tagging/context_test.go
Normal file
23
tagging/context_test.go
Normal file
|
@ -0,0 +1,23 @@
|
|||
package tagging
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestContext(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
tag, ok := IOTagFromContext(ctx)
|
||||
require.False(t, ok)
|
||||
require.Equal(t, "", tag)
|
||||
ctx = ContextWithIOTag(ctx, "tag1")
|
||||
tag, ok = IOTagFromContext(ctx)
|
||||
require.True(t, ok)
|
||||
require.Equal(t, "tag1", tag)
|
||||
ctx = ContextWithIOTag(ctx, "tag2")
|
||||
tag, ok = IOTagFromContext(ctx)
|
||||
require.True(t, ok)
|
||||
require.Equal(t, "tag2", tag)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue