Skip to content

Commit

Permalink
test: added TestNewConfigurationEmptyNodeList: chk for empty nodes
Browse files Browse the repository at this point in the history
This just adds a check that it will fail to pass an empty node list.
  • Loading branch information
meling committed Dec 13, 2024
1 parent def9894 commit d2fe799
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package gorums_test

import (
"context"
"errors"
"sync"
"testing"

Expand All @@ -10,6 +11,18 @@ import (
"github.com/relab/gorums/tests/dummy"
)

func TestNewConfigurationEmptyNodeList(t *testing.T) {
wantErr := errors.New("config: missing required node addresses")
mgr := gorums.NewRawManager(gorums.WithNoConnect())
_, err := gorums.NewRawConfiguration(mgr, gorums.WithNodeList([]string{}))
if err == nil {
t.Fatalf("Expected error, got: %v, want: %v", err, wantErr)
}
if err.Error() != wantErr.Error() {
t.Errorf("Error = %q, expected %q", err.Error(), wantErr)
}
}

func TestNewConfigurationNodeList(t *testing.T) {
mgr := gorums.NewRawManager(gorums.WithNoConnect())
cfg, err := gorums.NewRawConfiguration(mgr, gorums.WithNodeList(nodes))
Expand Down

0 comments on commit d2fe799

Please sign in to comment.