From c688b8f4f958210000d4fac747fb563fd73c1d87 Mon Sep 17 00:00:00 2001 From: Ken Hibino Date: Tue, 14 Apr 2020 09:20:09 -0700 Subject: [PATCH] Fix test for base package --- internal/base/base_test.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/base/base_test.go b/internal/base/base_test.go index 208f204..7d59059 100644 --- a/internal/base/base_test.go +++ b/internal/base/base_test.go @@ -106,9 +106,9 @@ func TestWorkersKey(t *testing.T) { } } -// Test for process state being accessed by multiple goroutines. +// Test for server state being accessed by multiple goroutines. // Run with -race flag to check for data race. -func TestProcessStateConcurrentAccess(t *testing.T) { +func TestServerStateConcurrentAccess(t *testing.T) { ss := NewServerState("127.0.0.1", 1234, 10, map[string]int{"default": 1}, false) var wg sync.WaitGroup started := time.Now() @@ -124,6 +124,9 @@ func TestProcessStateConcurrentAccess(t *testing.T) { defer wg.Done() ss.SetStarted(started) ss.SetStatus(StatusRunning) + if status := ss.Status(); status != StatusRunning { + t.Errorf("(*ServerState).Status() = %v, want %v", status, StatusRunning) + } }() // Simulate processor starting worker goroutines.