Update supported go versions
Client: go
With the release of go 1.23, update supported go versions to 1.22+1.23
according to our go support policy.
Also update the code to use the new range loop feature introduced in go
1.22 when appropriate.
Also fix a bug in TSSLServerSocket.Addr that it does not return the
listener address.
diff --git a/test/go/src/common/clientserver_test.go b/test/go/src/common/clientserver_test.go
index a39519d..48203b6 100644
--- a/test/go/src/common/clientserver_test.go
+++ b/test/go/src/common/clientserver_test.go
@@ -22,6 +22,7 @@
import (
"context"
"errors"
+ "fmt"
"reflect"
"sync"
"testing"
@@ -42,10 +43,10 @@
}
var units = []test_unit{
- {"127.0.0.1", 9095, "", "", "binary", false},
- {"127.0.0.1", 9091, "", "", "compact", false},
- {"127.0.0.1", 9092, "", "", "binary", true},
- {"127.0.0.1", 9093, "", "", "compact", true},
+ {"127.0.0.1", 0, "", "", "binary", false},
+ {"127.0.0.1", 0, "", "", "compact", false},
+ {"127.0.0.1", 0, "", "", "binary", true},
+ {"127.0.0.1", 0, "", "", "compact", true},
}
func TestAllConnection(t *testing.T) {
@@ -61,29 +62,31 @@
}
func doUnit(t *testing.T, unit *test_unit) {
- ctrl := gomock.NewController(t)
- defer ctrl.Finish()
- handler := NewMockThriftTest(ctrl)
+ t.Run(fmt.Sprintf("%v", *unit), func(t *testing.T) {
+ ctrl := gomock.NewController(t)
+ defer ctrl.Finish()
+ handler := NewMockThriftTest(ctrl)
- processor, serverTransport, transportFactory, protocolFactory, err := GetServerParams(unit.host, unit.port, unit.domain_socket, unit.transport, unit.protocol, unit.ssl, "../../../keys", handler)
- if err != nil {
- t.Errorf("GetServerParams failed: %v", err)
- }
+ processor, serverTransport, transportFactory, protocolFactory, addr, err := GetServerParams(unit.host, unit.port, unit.domain_socket, unit.transport, unit.protocol, unit.ssl, "../../../keys", handler)
+ if err != nil {
+ t.Errorf("GetServerParams failed: %v", err)
+ }
- server := thrift.NewTSimpleServer4(processor, serverTransport, transportFactory, protocolFactory)
- if err = server.Listen(); err != nil {
- t.Errorf("Unable to start server: %v", err)
- return
- }
- go server.Serve()
- defer server.Stop()
- client, trans, err := StartClient(unit.host, unit.port, unit.domain_socket, unit.transport, unit.protocol, unit.ssl)
- if err != nil {
- t.Errorf("Unable to start client: %v", err)
- return
- }
- defer trans.Close()
- callEverythingWithMock(t, client, handler)
+ server := thrift.NewTSimpleServer4(processor, serverTransport, transportFactory, protocolFactory)
+ if err = server.Listen(); err != nil {
+ t.Errorf("Unable to start server: %v", err)
+ return
+ }
+ go server.Serve()
+ defer server.Stop()
+ client, trans, err := StartClient(addr, unit.transport, unit.protocol, unit.ssl)
+ if err != nil {
+ t.Errorf("Unable to start client: %v", err)
+ return
+ }
+ defer trans.Close()
+ callEverythingWithMock(t, client, handler)
+ })
}
var rmapmap = map[int32]map[int32]int32{