diff options
Diffstat (limited to 'internal/config/config_test.go')
| -rw-r--r-- | internal/config/config_test.go | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/internal/config/config_test.go b/internal/config/config_test.go index bccfb2e..973797a 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -6,47 +6,47 @@ import ( "testing" ) -func TestParticipantNumber(t *testing.T) { - conf := Config{Participants: []string{"localhost:1234", "hamburger:4321"}} +func TestNodeNumber(t *testing.T) { + conf := Config{Nodes: []string{"localhost:1234", "hamburger:4321"}} - num, err := conf.ParticipantNumber("localhost") + num, err := conf.NodeNumber("localhost") if err != nil { t.Errorf(err.Error()) } if num != 0 { - t.Errorf("localhost should be participant number 0 but is %d", num) + t.Errorf("localhost should be node number 0 but is %d", num) } - num, err = conf.ParticipantNumber("hamburger") + num, err = conf.NodeNumber("hamburger") if err != nil { t.Errorf(err.Error()) } if num != 1 { - t.Errorf("hamburger should be participant number 1 but is %d", num) + t.Errorf("hamburger should be node number 1 but is %d", num) } - _, err = conf.ParticipantNumber("doener") + _, err = conf.NodeNumber("doener") if err == nil { - t.Errorf("doener is not a participant") + t.Errorf("doener is not a node") } } -func TestIsParticipant(t *testing.T) { - conf := Config{Participants: []string{"localhost:1234", "hamburger:4321"}} +func TestIsNode(t *testing.T) { + conf := Config{Nodes: []string{"localhost:1234", "hamburger:4321"}} remoteAddr := "localhost:323232" - if !conf.IsParticipant(remoteAddr) { - t.Errorf("%s should be participant of %v", remoteAddr, conf.Participants) + if !conf.IsNode(remoteAddr) { + t.Errorf("%s should be node of %v", remoteAddr, conf.Nodes) } remoteAddr = "foo.zone:2345" - if conf.IsParticipant(remoteAddr) { - t.Errorf("%s should not be participant of %v", remoteAddr, conf.Participants) + if conf.IsNode(remoteAddr) { + t.Errorf("%s should not be node of %v", remoteAddr, conf.Nodes) } } -func TestIsParticipantWithLookup(t *testing.T) { - conf := Config{Participants: []string{"localhost:1234", "hamburger:4321"}} +func TestIsNodeWithLookup(t *testing.T) { + conf := Config{Nodes: []string{"localhost:1234", "hamburger:4321"}} lookupIP := func(addr string) ([]net.IP, error) { switch addr { @@ -60,12 +60,12 @@ func TestIsParticipantWithLookup(t *testing.T) { } remoteAddr := "127.0.0.1:323232" - if !conf.IsParticipantWithLookup(remoteAddr, lookupIP) { - t.Errorf("%s should be participant of %v", remoteAddr, conf.Participants) + if !conf.IsNodeWithLookup(remoteAddr, lookupIP) { + t.Errorf("%s should be node of %v", remoteAddr, conf.Nodes) } remoteAddr = "9.9.9.9:2345" - if conf.IsParticipantWithLookup(remoteAddr, lookupIP) { - t.Errorf("%s should not be participant of %v", remoteAddr, conf.Participants) + if conf.IsNodeWithLookup(remoteAddr, lookupIP) { + t.Errorf("%s should not be node of %v", remoteAddr, conf.Nodes) } } |
