github.com/ravendb/ravendb-go-client@v0.0.0-20240229102137-4474ee7aa0fa/tests/get_tcp_info_test.go (about)

     1  package tests
     2  
     3  import (
     4  	"testing"
     5  
     6  	ravendb "github.com/ravendb/ravendb-go-client"
     7  	"github.com/stretchr/testify/assert"
     8  )
     9  
    10  func getTcpInfoTestCanGetTcpInfo(t *testing.T, driver *RavenTestDriver) {
    11  	store := driver.getDocumentStoreMust(t)
    12  	defer store.Close()
    13  
    14  	command := ravendb.NewGetTcpInfoCommand("test", "")
    15  	err := store.GetRequestExecutor("").ExecuteCommand(command, nil)
    16  	assert.NoError(t, err)
    17  	result := command.Result
    18  	assert.NotNil(t, result)
    19  	assert.Nil(t, result.Certificate)
    20  	// Note: in Java this tests for non-nil but Port is not sent
    21  	// in Json, so don't quite understand that. Unless Java check
    22  	// is bogus
    23  	assert.Equal(t, 0, result.Port)
    24  	assert.NotEmpty(t, result.URL)
    25  }
    26  
    27  func TestGetTcpInfo(t *testing.T) {
    28  	driver := createTestDriver(t)
    29  	destroy := func() { destroyDriver(t, driver) }
    30  	defer recoverTest(t, destroy)
    31  
    32  	getTcpInfoTestCanGetTcpInfo(t, driver)
    33  }