@@ -36,8 +36,8 @@ import (
36
36
"testing"
37
37
"time"
38
38
39
- "github.com/nats-io/gnatsd /server"
40
- gnatsd "github.com/nats-io/gnatsd /test"
39
+ "github.com/nats-io/nats-server /server"
40
+ natsserver "github.com/nats-io/nats-server /test"
41
41
"github.com/nats-io/nkeys"
42
42
)
43
43
@@ -112,13 +112,13 @@ var reconnectOpts = Options{
112
112
}
113
113
114
114
func RunServerOnPort (port int ) * server.Server {
115
- opts := gnatsd .DefaultTestOptions
115
+ opts := natsserver .DefaultTestOptions
116
116
opts .Port = port
117
117
return RunServerWithOptions (& opts )
118
118
}
119
119
120
120
func RunServerWithOptions (opts * server.Options ) * server.Server {
121
- return gnatsd .RunServer (opts )
121
+ return natsserver .RunServer (opts )
122
122
}
123
123
124
124
func TestReconnectServerStats (t * testing.T ) {
@@ -1045,25 +1045,25 @@ func TestAsyncINFO(t *testing.T) {
1045
1045
if err != nil || c .ps .state != OP_START {
1046
1046
t .Fatalf ("Unexpected: %d : %v\n " , c .ps .state , err )
1047
1047
}
1048
- // Pool now should contain localhost :4222 (the default URL) and localhost:5222
1049
- checkPool ("localhost:4222" , "localhost:5222" )
1048
+ // Pool now should contain 127.0.0.1 :4222 (the default URL), localhost:4222 and localhost:5222
1049
+ checkPool ("127.0.0.1:4222" , " localhost:4222" , "localhost:5222" )
1050
1050
1051
1051
// Make sure that if client receives the same, it is not added again.
1052
1052
err = c .parse (info )
1053
1053
if err != nil || c .ps .state != OP_START {
1054
1054
t .Fatalf ("Unexpected: %d : %v\n " , c .ps .state , err )
1055
1055
}
1056
- // Pool should still contain localhost :4222 (the default URL) and localhost:5222
1057
- checkPool ("localhost:4222" , "localhost:5222" )
1056
+ // Pool should still contain 127.0.0.1 :4222 (the default URL), localhost:4222 and localhost:5222
1057
+ checkPool ("127.0.0.1:4222" , " localhost:4222" , "localhost:5222" )
1058
1058
1059
1059
// Receive a new URL
1060
1060
info = []byte ("INFO {\" connect_urls\" :[\" localhost:4222\" , \" localhost:5222\" , \" localhost:6222\" ]}\r \n " )
1061
1061
err = c .parse (info )
1062
1062
if err != nil || c .ps .state != OP_START {
1063
1063
t .Fatalf ("Unexpected: %d : %v\n " , c .ps .state , err )
1064
1064
}
1065
- // Pool now should contain localhost :4222 (the default URL) localhost:5222 and localhost:6222
1066
- checkPool ("localhost:4222" , "localhost:5222" , "localhost:6222" )
1065
+ // Pool now should contain 127.0.0.1 :4222 (the default URL), localhost:4222, localhost:5222 and localhost:6222
1066
+ checkPool ("127.0.0.1:4222" , " localhost:4222" , "localhost:5222" , "localhost:6222" )
1067
1067
1068
1068
// Check that pool may be randomized on setup, but new URLs are always
1069
1069
// added at end of pool.
@@ -1130,7 +1130,7 @@ func TestConnServers(t *testing.T) {
1130
1130
}
1131
1131
1132
1132
// check the default url
1133
- validateURLs (c .Servers (), "nats://localhost :4222" )
1133
+ validateURLs (c .Servers (), "nats://127.0.0.1 :4222" )
1134
1134
if len (c .DiscoveredServers ()) != 0 {
1135
1135
t .Fatalf ("Expected no discovered servers" )
1136
1136
}
@@ -1141,7 +1141,7 @@ func TestConnServers(t *testing.T) {
1141
1141
t .Fatalf ("Unexpected: %d : %v\n " , c .ps .state , err )
1142
1142
}
1143
1143
// Server list should now contain both the default and the new url.
1144
- validateURLs (c .Servers (), "nats://localhost :4222" , "nats://localhost:5222" )
1144
+ validateURLs (c .Servers (), "nats://127.0.0.1 :4222" , "nats://localhost:5222" )
1145
1145
// Discovered servers should only contain the new url.
1146
1146
validateURLs (c .DiscoveredServers (), "nats://localhost:5222" )
1147
1147
@@ -1302,7 +1302,7 @@ SUAMK2FG4MI6UE3ACF3FK3OIQBCEIEZV7NSWFFEW63UXMRLFM2XLAXK4GY
1302
1302
func runTrustServer () * server.Server {
1303
1303
kp , _ := nkeys .FromSeed (oSeed )
1304
1304
pub , _ := kp .PublicKey ()
1305
- opts := gnatsd .DefaultTestOptions
1305
+ opts := natsserver .DefaultTestOptions
1306
1306
opts .Port = TEST_PORT
1307
1307
opts .TrustedKeys = []string {string (pub )}
1308
1308
s := RunServerWithOptions (& opts )
@@ -1407,7 +1407,7 @@ func TestUserCredentialsChainedFileNotFoundError(t *testing.T) {
1407
1407
// Setup opts for both servers.
1408
1408
kp , _ := nkeys .FromSeed (oSeed )
1409
1409
pub , _ := kp .PublicKey ()
1410
- opts := gnatsd .DefaultTestOptions
1410
+ opts := natsserver .DefaultTestOptions
1411
1411
opts .Port = - 1
1412
1412
opts .Cluster .Port = - 1
1413
1413
opts .TrustedKeys = []string {string (pub )}
@@ -1466,7 +1466,7 @@ func TestNkeyAuth(t *testing.T) {
1466
1466
kp , _ := nkeys .FromSeed (seed )
1467
1467
pub , _ := kp .PublicKey ()
1468
1468
1469
- sopts := gnatsd .DefaultTestOptions
1469
+ sopts := natsserver .DefaultTestOptions
1470
1470
sopts .Port = TEST_PORT
1471
1471
sopts .Nkeys = []* server.NkeyUser {& server.NkeyUser {Nkey : string (pub )}}
1472
1472
ts := RunServerWithOptions (& sopts )
@@ -1633,7 +1633,7 @@ func TestLookupHostResultIsRandomized(t *testing.T) {
1633
1633
t .Skip ("Was looking for IPv4 and IPv6 addresses for localhost to perform test" )
1634
1634
}
1635
1635
1636
- opts := gnatsd .DefaultTestOptions
1636
+ opts := natsserver .DefaultTestOptions
1637
1637
opts .Host = "127.0.0.1"
1638
1638
opts .Port = TEST_PORT
1639
1639
s1 := RunServerWithOptions (& opts )
@@ -1667,7 +1667,7 @@ func TestLookupHostResultIsNotRandomizedWithNoRandom(t *testing.T) {
1667
1667
t .Skip ("Was looking for IPv4 and IPv6 addresses for localhost to perform test" )
1668
1668
}
1669
1669
1670
- opts := gnatsd .DefaultTestOptions
1670
+ opts := natsserver .DefaultTestOptions
1671
1671
opts .Host = orgAddrs [0 ]
1672
1672
opts .Port = TEST_PORT
1673
1673
s1 := RunServerWithOptions (& opts )
0 commit comments