Skip to content

Commit

Permalink
refactor: rename localhost to 127.0.0.1 in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tochemey committed Aug 3, 2024
1 parent 24d6fee commit 26e44c4
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ package main
import "github.com/tochemey/goakt/v2/discovery/nats"

const (
natsServerAddr = "nats://localhost:4248"
natsServerAddr = "nats://127.0.0.1:4248"
natsSubject = "goakt-gossip"
applicationName = "accounts"
actorSystemName = "AccountsSystem"
Expand Down
2 changes: 1 addition & 1 deletion actors/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1820,7 +1820,7 @@ func TestAPIRemoteSpawn(t *testing.T) {
// generate the remoting port
ports := dynaport.Get(1)
remotingPort := ports[0]
host := "localhost"
host := "127.0.0.1"

// create the actor system
sys, err := NewActorSystem("test",
Expand Down
16 changes: 8 additions & 8 deletions discovery/nats/discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func newPeer(t *testing.T, serverAddr string) *Discovery {
remotingPort := nodePorts[2]

// create a Cluster node
host := "localhost"
host := "127.0.0.1"
// create the various config option
applicationName := "accounts"
actorSystemName := "AccountsSystem"
Expand Down Expand Up @@ -114,7 +114,7 @@ func TestDiscovery(t *testing.T) {
remotingPort := nodePorts[2]

// create a Cluster node
host := "localhost"
host := "127.0.0.1"
// create the various config option
applicationName := "accounts"
actorSystemName := "AccountsSystem"
Expand Down Expand Up @@ -158,7 +158,7 @@ func TestDiscovery(t *testing.T) {
remotingPort := nodePorts[2]

// create a Cluster node
host := "localhost"
host := "127.0.0.1"
// create the various config option
applicationName := "accounts"
actorSystemName := "AccountsSystem"
Expand Down Expand Up @@ -195,7 +195,7 @@ func TestDiscovery(t *testing.T) {
remotingPort := nodePorts[2]

// create a Cluster node
host := "localhost"
host := "127.0.0.1"

// create the various config option
natsServer := srv.Addr().String()
Expand Down Expand Up @@ -240,7 +240,7 @@ func TestDiscovery(t *testing.T) {
remotingPort := nodePorts[2]

// create a Cluster node
host := "localhost"
host := "127.0.0.1"

// create the various config option
natsServer := srv.Addr().String()
Expand Down Expand Up @@ -280,7 +280,7 @@ func TestDiscovery(t *testing.T) {
remotingPort := nodePorts[2]

// create a Cluster node
host := "localhost"
host := "127.0.0.1"

// create the various config option
natsServer := srv.Addr().String()
Expand Down Expand Up @@ -322,7 +322,7 @@ func TestDiscovery(t *testing.T) {
remotingPort := nodePorts[2]

// create a Cluster node
host := "localhost"
host := "127.0.0.1"

// create the various config option
natsServer := srv.Addr().String()
Expand Down Expand Up @@ -423,7 +423,7 @@ func TestDiscovery(t *testing.T) {
remotingPort := nodePorts[2]

// create a Cluster node
host := "localhost"
host := "127.0.0.1"

// create the various config option
natsServer := srv.Addr().String()
Expand Down
2 changes: 1 addition & 1 deletion internal/cluster/codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestCodec(t *testing.T) {
actor := &internalpb.WireActor{
ActorName: "account-1",
ActorAddress: &goaktpb.Address{
Host: "localhost",
Host: "127.0.0.1",
Port: 2345,
Name: "account-1",
Id: uuid.NewString(),
Expand Down
2 changes: 1 addition & 1 deletion internal/cluster/discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func TestDiscoveryProvider(t *testing.T) {
gossipPort := nodePorts[0]

addrs := []string{
fmt.Sprintf("localhost:%d", gossipPort),
fmt.Sprintf("127.0.0.1:%d", gossipPort),
}
// mock the underlying discovery provider
provider := new(testkit.Provider)
Expand Down
16 changes: 8 additions & 8 deletions internal/cluster/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestSingleNode(t *testing.T) {

// define discovered addresses
addrs := []string{
fmt.Sprintf("localhost:%d", gossipPort),
fmt.Sprintf("127.0.0.1:%d", gossipPort),
}

// mock the discovery provider
Expand All @@ -75,7 +75,7 @@ func TestSingleNode(t *testing.T) {
provider.EXPECT().Close().Return(nil)

// create a Node startNode
host := "localhost"
host := "127.0.0.1"

hostNode := discovery.Node{
Name: host,
Expand Down Expand Up @@ -117,7 +117,7 @@ func TestSingleNode(t *testing.T) {

// define discovered addresses
addrs := []string{
fmt.Sprintf("localhost:%d", gossipPort),
fmt.Sprintf("127.0.0.1:%d", gossipPort),
}

// mock the discovery provider
Expand All @@ -131,7 +131,7 @@ func TestSingleNode(t *testing.T) {
provider.EXPECT().Close().Return(nil)

// create a Node startNode
host := "localhost"
host := "127.0.0.1"
hostNode := discovery.Node{
Name: host,
Host: host,
Expand Down Expand Up @@ -187,7 +187,7 @@ func TestSingleNode(t *testing.T) {

// define discovered addresses
addrs := []string{
fmt.Sprintf("localhost:%d", gossipPort),
fmt.Sprintf("127.0.0.1:%d", gossipPort),
}

// mock the discovery provider
Expand All @@ -201,7 +201,7 @@ func TestSingleNode(t *testing.T) {
provider.EXPECT().Close().Return(nil)

// create a Node startNode
host := "localhost"
host := "127.0.0.1"
hostNode := discovery.Node{
Name: host,
Host: host,
Expand Down Expand Up @@ -254,7 +254,7 @@ func TestSingleNode(t *testing.T) {

// define discovered addresses
addrs := []string{
fmt.Sprintf("localhost:%d", gossipPort),
fmt.Sprintf("127.0.0.1:%d", gossipPort),
}

// mock the discovery provider
Expand All @@ -268,7 +268,7 @@ func TestSingleNode(t *testing.T) {
provider.EXPECT().Close().Return(nil)

// create a Node startNode
host := "localhost"
host := "127.0.0.1"
hostNode := discovery.Node{
Name: host,
Host: host,
Expand Down
4 changes: 2 additions & 2 deletions internal/http/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ func TestClient(t *testing.T) {
}

func TestURL(t *testing.T) {
host := "localhost"
host := "127.0.0.1"
port := 123

url := URL(host, port)
assert.Equal(t, "http://localhost:123", url)
assert.Equal(t, "http://127.0.0.1:123", url)
}

0 comments on commit 26e44c4

Please sign in to comment.