2021-01-28 14:58:32 +00:00
|
|
|
package slashingprotection
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
|
|
|
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
|
|
|
"google.golang.org/grpc/metadata"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestGrpcHeaders(t *testing.T) {
|
|
|
|
s := &Service{
|
2021-03-21 17:53:17 +00:00
|
|
|
cfg: &Config{},
|
2021-01-28 14:58:32 +00:00
|
|
|
ctx: context.Background(),
|
|
|
|
grpcHeaders: []string{"first=value1", "second=value2"},
|
|
|
|
}
|
|
|
|
s.startSlasherClient()
|
|
|
|
md, _ := metadata.FromOutgoingContext(s.ctx)
|
2021-06-02 05:44:34 +00:00
|
|
|
require.Equal(t, 2, md.Len(), "MetadataV0 contains wrong number of values")
|
2021-01-28 14:58:32 +00:00
|
|
|
assert.Equal(t, "value1", md.Get("first")[0])
|
|
|
|
assert.Equal(t, "value2", md.Get("second")[0])
|
|
|
|
}
|