go-hep.org/x/hep@v0.38.1/xrootd/bind_test.go (about)

     1  // Copyright ©2018 The go-hep Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build !ci
     6  
     7  package xrootd
     8  
     9  import (
    10  	"context"
    11  	"testing"
    12  )
    13  
    14  func testNewSubSession(t *testing.T, addr string) {
    15  	session, err := newSession(context.Background(), addr, "gopher", "", nil)
    16  	if err != nil {
    17  		t.Fatalf("could not create initialSession: %v", err)
    18  	}
    19  	defer session.Close()
    20  
    21  	subSession, err := newSubSession(context.Background(), session)
    22  	if err != nil {
    23  		t.Fatalf("could not create subSession: %v", err)
    24  	}
    25  
    26  	if subSession.pathID == 0 {
    27  		t.Fatalf("incorrect subSession.pathID value of 0 was received")
    28  	}
    29  
    30  	session.subs[subSession.pathID] = subSession
    31  }
    32  
    33  func TestNewSubSession(t *testing.T) {
    34  	for _, addr := range testClientAddrs {
    35  		t.Run(addr, func(t *testing.T) {
    36  			testNewSubSession(t, addr)
    37  		})
    38  	}
    39  }