1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
package metadata
import (
"errors"
"testing"
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/storage"
"gitlab.com/gitlab-org/gitaly/v14/internal/testhelper"
)
func TestOutgoingToIncoming(t *testing.T) {
ctx := testhelper.Context(t)
ctx, err := storage.InjectGitalyServers(ctx, "a", "b", "c")
require.NoError(t, err)
_, err = storage.ExtractGitalyServer(ctx, "a")
require.Equal(t, errors.New("empty gitaly-servers metadata"), err,
"server should not be found in the incoming context")
ctx = OutgoingToIncoming(ctx)
info, err := storage.ExtractGitalyServer(ctx, "a")
require.NoError(t, err)
require.Equal(t, storage.ServerInfo{Address: "b", Token: "c"}, info)
}
|