-
Notifications
You must be signed in to change notification settings - Fork 35
/
protocol_test.go
39 lines (32 loc) · 966 Bytes
/
protocol_test.go
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
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright 2018 The go-hep Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package xrootd
import (
"context"
"reflect"
"testing"
"go-hep.org/x/hep/xrootd/xrdproto/protocol"
)
func testSession_Protocol(t *testing.T, addr string) {
want := protocol.Response{BinaryProtocolVersion: 784, Flags: protocol.IsServer}
session, err := newSession(context.Background(), addr, "gopher", "", nil)
if err != nil {
t.Fatalf("could not create initialSession: %v", err)
}
defer session.Close()
got, err := session.Protocol(context.Background())
if err != nil {
t.Fatalf("invalid protocol call: %v", err)
}
if !reflect.DeepEqual(got, want) {
t.Errorf("session.Protocol()\ngot = %v\nwant = %v", got, want)
}
}
func TestSession_Protocol(t *testing.T) {
for _, addr := range testClientAddrs {
t.Run(addr, func(t *testing.T) {
testSession_Protocol(t, addr)
})
}
}