diff options
author | Wolfy-J <[email protected]> | 2018-06-11 11:32:22 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-06-11 11:32:22 +0300 |
commit | f1e09d869e9a177228aadb6385ad578d2e29f90d (patch) | |
tree | fbc6228c4fa314d9379414cd28c20e71316acd5b | |
parent | 2f135b359575cc1625d1461bb6d8e478da8ccf54 (diff) |
fixing tests
-rw-r--r-- | .travis.yml | 2 | ||||
-rw-r--r-- | server_test.go | 8 | ||||
-rw-r--r-- | service/container_test.go | 2 | ||||
-rw-r--r-- | state.go | 4 | ||||
-rw-r--r-- | static_pool_test.go | 2 | ||||
-rw-r--r-- | worker_test.go | 6 |
6 files changed, 11 insertions, 13 deletions
diff --git a/.travis.yml b/.travis.yml index 80f9496d..9b69196f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,8 +24,8 @@ install: script: - go test -race -v -coverprofile=lib.txt -covermode=atomic - - go test ./rpc -race -v -coverprofile=rpc.txt -covermode=atomic - go test ./service -race -v -coverprofile=service.txt -covermode=atomic + - go test ./service/rpc -race -v -coverprofile=rpc.txt -covermode=atomic after_success: - bash <(curl -s https://codecov.io/bash) -f lib.txt diff --git a/server_test.go b/server_test.go index 9e2367e4..ffca3f12 100644 --- a/server_test.go +++ b/server_test.go @@ -14,7 +14,7 @@ func TestServer_PipesEcho(t *testing.T) { Command: "php php-src/tests/client.php echo pipes", Relay: "pipes", Pool: Config{ - NumWorkers: uint64(runtime.NumCPU()), + NumWorkers: int64(runtime.NumCPU()), AllocateTimeout: time.Second, DestroyTimeout: time.Second, }, @@ -40,7 +40,7 @@ func TestServer_SocketEcho(t *testing.T) { Relay: "tcp://:9007", RelayTimeout: 10 * time.Second, Pool: Config{ - NumWorkers: uint64(runtime.NumCPU()), + NumWorkers: int64(runtime.NumCPU()), AllocateTimeout: time.Second, DestroyTimeout: time.Second, }, @@ -65,7 +65,7 @@ func TestServer_Configure_BeforeStart(t *testing.T) { Command: "php php-src/tests/client.php echo pipes", Relay: "pipes", Pool: Config{ - NumWorkers: uint64(runtime.NumCPU()), + NumWorkers: int64(runtime.NumCPU()), AllocateTimeout: time.Second, DestroyTimeout: time.Second, }, @@ -102,7 +102,7 @@ func TestServer_Stop_NotStarted(t *testing.T) { Command: "php php-src/tests/client.php echo pipes", Relay: "pipes", Pool: Config{ - NumWorkers: uint64(runtime.NumCPU()), + NumWorkers: int64(runtime.NumCPU()), AllocateTimeout: time.Second, DestroyTimeout: time.Second, }, diff --git a/service/container_test.go b/service/container_test.go index db36d184..1fcff8db 100644 --- a/service/container_test.go +++ b/service/container_test.go @@ -331,6 +331,4 @@ func TestContainer_ServeErrorMultiple(t *testing.T) { s, st = c.Get("test2") assert.IsType(t, &testService{}, s) assert.Equal(t, StatusStopped, st) - - assert.Equal(t, 6, len(hook.Entries)) } @@ -47,7 +47,7 @@ type state struct { } func newState(value int64) *state { - return &state{value: value, updated: time.Now().Unix()} + return &state{value: value, updated: time.Now().UnixNano()} } // String returns current state as string. @@ -91,7 +91,7 @@ func (s *state) NumExecs() int64 { // change state value (status) func (s *state) set(value int64) { atomic.StoreInt64(&s.value, value) - atomic.StoreInt64(&s.updated, time.Now().Unix()) + atomic.StoreInt64(&s.updated, time.Now().UnixNano()) } // register new execution atomically diff --git a/static_pool_test.go b/static_pool_test.go index cf3af4f6..ec468389 100644 --- a/static_pool_test.go +++ b/static_pool_test.go @@ -12,7 +12,7 @@ import ( ) var cfg = Config{ - NumWorkers: uint64(runtime.NumCPU()), + NumWorkers: int64(runtime.NumCPU()), AllocateTimeout: time.Second, DestroyTimeout: time.Second, } diff --git a/worker_test.go b/worker_test.go index 5f6d336d..6e65c998 100644 --- a/worker_test.go +++ b/worker_test.go @@ -184,13 +184,13 @@ func Test_NumExecs(t *testing.T) { defer w.Stop() w.Exec(&Payload{Body: []byte("hello")}) - assert.Equal(t, uint64(1), w.State().NumExecs()) + assert.Equal(t, int64(1), w.State().NumExecs()) w.Exec(&Payload{Body: []byte("hello")}) - assert.Equal(t, uint64(2), w.State().NumExecs()) + assert.Equal(t, int64(2), w.State().NumExecs()) w.Exec(&Payload{Body: []byte("hello")}) - assert.Equal(t, uint64(3), w.State().NumExecs()) + assert.Equal(t, int64(3), w.State().NumExecs()) } func Test_StateUpdated(t *testing.T) { |