diff options
| author | Paul Buetow <paul@buetow.org> | 2023-06-20 01:37:50 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2023-06-20 01:37:50 +0300 |
| commit | b5126ef9aace14f53717442798bca79a8b6cd75b (patch) | |
| tree | beb15620ae1967376be87bf9ff6fb33502e3f8bc /internal/quorum | |
| parent | 6f62f93569809f01b24e9f86c7ef0df50c8ddeaa (diff) | |
refactoring Config
Diffstat (limited to 'internal/quorum')
| -rw-r--r-- | internal/quorum/quorum_test.go | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/internal/quorum/quorum_test.go b/internal/quorum/quorum_test.go index a5fcbbf..b88b4fb 100644 --- a/internal/quorum/quorum_test.go +++ b/internal/quorum/quorum_test.go @@ -12,10 +12,11 @@ var inOneHour = time.Now().Add(1 * time.Hour) func TestScore(t *testing.T) { t.Parallel() - var ( - conf = config.Config{Nodes: []string{"foo:1234", "bar:4321", "baz:3444"}} - quo = New(conf) + + conf, _ := config.New( + config.Config{Nodes: []string{"foo:1234", "bar:4321", "baz:3444"}}, ) + quo := New(conf) vote1, _ := vote.New(conf, []string{"foo", "bar"}) vote1.FromID = "foo" @@ -68,10 +69,10 @@ func TestTieScore(t *testing.T) { t.Run("First tie score test", func(t *testing.T) { // If it is a tie, the first particpant (here: "foo") will win. - var ( - conf = config.Config{Nodes: []string{"foo:1234", "bar:4321", "baz:3444"}} - quo = New(conf) + conf, _ := config.New( + config.Config{Nodes: []string{"foo:1234", "bar:4321", "baz:3444"}}, ) + quo := New(conf) addVotes(conf, quo) scores := quo.scores() @@ -91,10 +92,10 @@ func TestTieScore(t *testing.T) { t.Run("Second tie score test", func(t *testing.T) { // If it is a tie, the first particpant (here: "bar") will win. - var ( - conf = config.Config{Nodes: []string{"bar:1234", "foo:4321", "baz:3444"}} - quo = New(conf) + conf, _ := config.New( + config.Config{Nodes: []string{"bar:1234", "foo:4321", "baz:3444"}}, ) + quo := New(conf) addVotes(conf, quo) scores := quo.scores() @@ -114,10 +115,10 @@ func TestTieScore(t *testing.T) { } func TestExpire(t *testing.T) { - var ( - conf = config.Config{Nodes: []string{"foo:1234", "bar:4321", "bay:2212"}} - quo = New(conf) + conf, _ := config.New( + config.Config{Nodes: []string{"foo:1234", "bar:4321", "bay:2212"}}, ) + quo := New(conf) vote1, _ := vote.New(conf, []string{"bar", "baz", "bay"}) vote1.FromID = "foo" @@ -148,10 +149,10 @@ func TestExpire(t *testing.T) { } func TestLiveNodes(t *testing.T) { - var ( - conf = config.Config{Nodes: []string{"foo:1234", "bay:4321"}} - quo = New(conf) + conf, _ := config.New( + config.Config{Nodes: []string{"foo:1234", "bay:4321"}}, ) + quo := New(conf) vote1, _ := vote.New(conf, []string{"bar", "baz", "bay"}) vote1.ExpiresAt = inOneHour |
