summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2023-06-13 00:45:56 +0300
committerPaul Buetow <paul@buetow.org>2023-06-13 00:45:56 +0300
commita04fa17d3719e5435c35a599cf566630a08108a8 (patch)
treec408326acd9a1855874e949dff1da5d12e9f5ef4 /internal
parentfad6312fc02c71a42c3b28af0946e0833916d37f (diff)
use race detector for the tests and also run tests in parallel
Diffstat (limited to 'internal')
-rw-r--r--internal/config/config_test.go3
-rw-r--r--internal/quorum/quorum_test.go1
-rw-r--r--internal/utils/string_test.go1
-rw-r--r--internal/vote/vote_test.go3
4 files changed, 8 insertions, 0 deletions
diff --git a/internal/config/config_test.go b/internal/config/config_test.go
index 973797a..2fcfefb 100644
--- a/internal/config/config_test.go
+++ b/internal/config/config_test.go
@@ -7,6 +7,7 @@ import (
)
func TestNodeNumber(t *testing.T) {
+ t.Parallel()
conf := Config{Nodes: []string{"localhost:1234", "hamburger:4321"}}
num, err := conf.NodeNumber("localhost")
@@ -32,6 +33,7 @@ func TestNodeNumber(t *testing.T) {
}
func TestIsNode(t *testing.T) {
+ t.Parallel()
conf := Config{Nodes: []string{"localhost:1234", "hamburger:4321"}}
remoteAddr := "localhost:323232"
@@ -46,6 +48,7 @@ func TestIsNode(t *testing.T) {
}
func TestIsNodeWithLookup(t *testing.T) {
+ t.Parallel()
conf := Config{Nodes: []string{"localhost:1234", "hamburger:4321"}}
lookupIP := func(addr string) ([]net.IP, error) {
diff --git a/internal/quorum/quorum_test.go b/internal/quorum/quorum_test.go
index ad78938..f5d847e 100644
--- a/internal/quorum/quorum_test.go
+++ b/internal/quorum/quorum_test.go
@@ -11,6 +11,7 @@ import (
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)
diff --git a/internal/utils/string_test.go b/internal/utils/string_test.go
index 10a7f83..dfdc893 100644
--- a/internal/utils/string_test.go
+++ b/internal/utils/string_test.go
@@ -5,6 +5,7 @@ import (
)
func TestStripPort(t *testing.T) {
+ t.Parallel()
if "localhost" != StripPort("localhost:1234") {
t.Errorf("unable to split port from \"localhost:1234\"")
}
diff --git a/internal/vote/vote_test.go b/internal/vote/vote_test.go
index a2a851b..cccb1be 100644
--- a/internal/vote/vote_test.go
+++ b/internal/vote/vote_test.go
@@ -7,6 +7,7 @@ import (
)
func TestVote(t *testing.T) {
+ t.Parallel()
v, _ := New([]string{"foo", "bar", "baz", "bay"})
hostname, _ := os.Hostname()
@@ -28,6 +29,7 @@ func TestVote(t *testing.T) {
}
func TestVoteExpiry(t *testing.T) {
+ t.Parallel()
v, _ := New([]string{"foo", "bar", "baz", "bay"})
// Set expiry 1h into the future
@@ -44,6 +46,7 @@ func TestVoteExpiry(t *testing.T) {
}
func TestMarshalling(t *testing.T) {
+ t.Parallel()
v, _ := New([]string{"foo", "bar", "baz", "bay"})
jsonStr, err := v.ToJSON()
if err != nil {