Skip to content

Commit

Permalink
Prepare for release 0.14.3
Browse files Browse the repository at this point in the history
- update tests based on staticcheck reports
- update version info in README outputs

Signed-off-by: Ivan Kozlovic <[email protected]>
  • Loading branch information
kozlovic committed May 31, 2019
1 parent 5dc1190 commit 8ce1a7e
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 40 deletions.
62 changes: 31 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -825,13 +825,13 @@ various general statistics.
```
{
"cluster_id": "test-cluster",
"server_id": "JEzjfVQS4JIEzM7lZmWHm9",
"version": "0.14.2",
"server_id": "xMp6S8ujCdq1f6K1zLQ7Jx",
"version": "0.14.3",
"go": "go1.11.10",
"state": "STANDALONE",
"now": "2019-05-21T11:09:35.364637-06:00",
"start_time": "2019-05-21T11:09:24.204869-06:00",
"uptime": "11s",
"now": "2019-05-31T10:40:20.103701-06:00",
"start_time": "2019-05-31T10:40:17.72128-06:00",
"uptime": "2s",
"clients": 0,
"subscriptions": 0,
"channels": 0,
Expand All @@ -845,13 +845,13 @@ Here is an example:
```
{
"cluster_id": "test-cluster",
"server_id": "t9W9zbOIIi5Y9Guppxl0lF",
"version": "0.14.2",
"server_id": "tD1uT9RDU117EnhbjfYiWy",
"version": "0.14.3",
"go": "go1.11.10",
"state": "CLUSTERED",
"role": "Follower",
"now": "2019-05-21T11:10:15.765261-06:00",
"start_time": "2019-05-21T11:10:12.21284-06:00",
"now": "2019-05-31T10:40:46.762166-06:00",
"start_time": "2019-05-31T10:40:43.690739-06:00",
"uptime": "3s",
"clients": 0,
"subscriptions": 0,
Expand Down Expand Up @@ -1174,26 +1174,26 @@ The NATS Streaming Server embeds a NATS Server. Starting the server with no argu

```
> ./nats-streaming-server
[78166] 2019/05/21 11:11:55.176519 [INF] STREAM: Starting nats-streaming-server[test-cluster] version 0.14.2
[78166] 2019/05/21 11:11:55.176607 [INF] STREAM: ServerID: Zea1oL1PCvdcPAjWYYI65l
[78166] 2019/05/21 11:11:55.176610 [INF] STREAM: Go version: go1.11.10
[78166] 2019/05/21 11:11:55.176612 [INF] STREAM: Git commit: [not set]
[78166] 2019/05/21 11:11:55.177090 [INF] Starting nats-server version 1.4.1
[78166] 2019/05/21 11:11:55.177096 [INF] Git commit [not set]
[78166] 2019/05/21 11:11:55.177274 [INF] Listening for client connections on 0.0.0.0:4222
[78166] 2019/05/21 11:11:55.177278 [INF] Server is ready
[78166] 2019/05/21 11:11:55.205993 [INF] STREAM: Recovering the state...
[78166] 2019/05/21 11:11:55.206010 [INF] STREAM: No recovered state
[78166] 2019/05/21 11:11:55.457928 [INF] STREAM: Message store is MEMORY
[78166] 2019/05/21 11:11:55.457987 [INF] STREAM: ---------- Store Limits ----------
[78166] 2019/05/21 11:11:55.457990 [INF] STREAM: Channels: 100 *
[78166] 2019/05/21 11:11:55.457992 [INF] STREAM: --------- Channels Limits --------
[78166] 2019/05/21 11:11:55.458008 [INF] STREAM: Subscriptions: 1000 *
[78166] 2019/05/21 11:11:55.458010 [INF] STREAM: Messages : 1000000 *
[78166] 2019/05/21 11:11:55.458012 [INF] STREAM: Bytes : 976.56 MB *
[78166] 2019/05/21 11:11:55.458014 [INF] STREAM: Age : unlimited *
[78166] 2019/05/21 11:11:55.458016 [INF] STREAM: Inactivity : unlimited *
[78166] 2019/05/21 11:11:55.458034 [INF] STREAM: ----------------------------------
[45214] 2019/05/31 10:58:21.697786 [INF] STREAM: Starting nats-streaming-server[test-cluster] version 0.14.3
[45214] 2019/05/31 10:58:21.697835 [INF] STREAM: ServerID: pshy3fbo9AuEtXcLvjwfQQ
[45214] 2019/05/31 10:58:21.697837 [INF] STREAM: Go version: go1.11.10
[45214] 2019/05/31 10:58:21.697839 [INF] STREAM: Git commit: [not set]
[45214] 2019/05/31 10:58:21.698338 [INF] Starting nats-server version 1.4.1
[45214] 2019/05/31 10:58:21.698345 [INF] Git commit [not set]
[45214] 2019/05/31 10:58:21.698520 [INF] Listening for client connections on 0.0.0.0:4222
[45214] 2019/05/31 10:58:21.698525 [INF] Server is ready
[45214] 2019/05/31 10:58:21.726481 [INF] STREAM: Recovering the state...
[45214] 2019/05/31 10:58:21.726495 [INF] STREAM: No recovered state
[45214] 2019/05/31 10:58:21.982074 [INF] STREAM: Message store is MEMORY
[45214] 2019/05/31 10:58:21.982110 [INF] STREAM: ---------- Store Limits ----------
[45214] 2019/05/31 10:58:21.982113 [INF] STREAM: Channels: 100 *
[45214] 2019/05/31 10:58:21.982115 [INF] STREAM: --------- Channels Limits --------
[45214] 2019/05/31 10:58:21.982117 [INF] STREAM: Subscriptions: 1000 *
[45214] 2019/05/31 10:58:21.982119 [INF] STREAM: Messages : 1000000 *
[45214] 2019/05/31 10:58:21.982121 [INF] STREAM: Bytes : 976.56 MB *
[45214] 2019/05/31 10:58:21.982123 [INF] STREAM: Age : unlimited *
[45214] 2019/05/31 10:58:21.982125 [INF] STREAM: Inactivity : unlimited *
[45214] 2019/05/31 10:58:21.982126 [INF] STREAM: ----------------------------------
```

The server will be started and listening for client connections on port 4222 (the default) from all available interfaces. The logs will be displayed to stderr as shown above.
Expand Down Expand Up @@ -1770,8 +1770,8 @@ Below is what would be displayed with the above store limits configuration. Noti
how `foo.bar.>` is indented compared to `foo.>` to show the inheritance.

```
[INF] STREAM: Starting nats-streaming-server[test-cluster] version 0.14.2
[INF] STREAM: ServerID: XStGXeAQhMgPpp4kXg5HNO
[INF] STREAM: Starting nats-streaming-server[test-cluster] version 0.14.3
[INF] STREAM: ServerID: GTYa5pcjZnQ6aSoO1PWMmT
[INF] STREAM: Go version: go1.11.10
[INF] STREAM: Git commit: [not set]
[INF] Starting nats-server version 1.4.1
Expand Down
19 changes: 17 additions & 2 deletions server/raft_log_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,19 @@ func TestRaftLogEncodeDecodeLogs(t *testing.T) {
}
}

errCh := make(chan error, 1)
// Perform concurrent encoding...
wg := sync.WaitGroup{}
encode := func(wg *sync.WaitGroup, min, max int) {
defer wg.Done()
for i := min; i < max; i++ {
l := logs[i]
if _, err := store.encodeRaftLog(l); err != nil {
t.Fatalf("Error during encoding")
select {
case errCh <- fmt.Errorf("Error during encoding: %v", err):
return
default:
}
}
}
}
Expand All @@ -205,7 +210,11 @@ func TestRaftLogEncodeDecodeLogs(t *testing.T) {
e := encoded[i]
var l raft.Log
if err := store.decodeRaftLog(e, &l); err != nil {
t.Fatalf("Error during encoding")
select {
case errCh <- fmt.Errorf("Error during decoding: %v", err):
return
default:
}
}
}
}
Expand All @@ -215,6 +224,12 @@ func TestRaftLogEncodeDecodeLogs(t *testing.T) {
go decode(&wg, 2*(total/4), 3*(total/4))
go decode(&wg, 3*(total/4), total)
wg.Wait()

select {
case e := <-errCh:
t.Fatal(e.Error())
default:
}
}

func TestRaftLogWithEncryption(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import (
// Server defaults.
const (
// VERSION is the current version for the NATS Streaming server.
VERSION = "0.14.2"
VERSION = "0.14.3"

DefaultClusterID = "test-cluster"
DefaultDiscoverPrefix = "_STAN.discover"
Expand Down
14 changes: 12 additions & 2 deletions server/server_durable_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016-2018 The NATS Authors
// Copyright 2016-2019 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down Expand Up @@ -822,6 +822,7 @@ func TestNewOnHoldSetOnDurableRestart(t *testing.T) {
stop := make(chan struct{})
wg := sync.WaitGroup{}
wg.Add(1)
errCh := make(chan error, 1)
go func() {
defer wg.Done()
for {
Expand All @@ -830,7 +831,11 @@ func TestNewOnHoldSetOnDurableRestart(t *testing.T) {
return
default:
if err := sc.Publish("foo", []byte("hello")); err != nil {
t.Fatalf("Unexpected error on publish: %v", err)
select {
case errCh <- fmt.Errorf("Unexpected error on publish: %v", err):
return
default:
}
}
}
}
Expand All @@ -853,6 +858,11 @@ func TestNewOnHoldSetOnDurableRestart(t *testing.T) {
if failed {
t.Fatal("Did not receive the redelivered messages first")
}
select {
case e := <-errCh:
t.Fatal(e.Error())
default:
}
}

func TestPersistentStoreDurableClosedStatusOnRestart(t *testing.T) {
Expand Down
19 changes: 17 additions & 2 deletions server/server_limits_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016-2018 The NATS Authors
// Copyright 2016-2019 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand All @@ -21,6 +21,7 @@ import (
"testing"
"time"

natsdTest "github.com/nats-io/gnatsd/test"
"github.com/nats-io/go-nats-streaming"
"github.com/nats-io/go-nats-streaming/pb"
"github.com/nats-io/nats-streaming-server/stores"
Expand Down Expand Up @@ -531,7 +532,11 @@ func TestMaxInactivity(t *testing.T) {
cleanupDatastore(t)
defer cleanupDatastore(t)

ns := natsdTest.RunDefaultServer()
defer ns.Shutdown()

opts := getTestDefaultOptsForPersistentStore()
opts.NATSServerURL = "nats://127.0.0.1:4222"
opts.MaxInactivity = 100 * time.Millisecond
fooStarLimits := &stores.ChannelLimits{MaxInactivity: 500 * time.Millisecond}
opts.AddPerChannel("foo.*", fooStarLimits)
Expand All @@ -547,6 +552,7 @@ func TestMaxInactivity(t *testing.T) {
defer sc.Close()

wg := sync.WaitGroup{}
errCh := make(chan error, 1)
// If a subscription exists, channel should not be removed.
checkChannelNotDeletedDueToSub := func(channel, queue, dur string) {
defer wg.Done()
Expand All @@ -560,7 +566,11 @@ func TestMaxInactivity(t *testing.T) {
sub, err = sc.QueueSubscribe(channel, queue, func(_ *stan.Msg) {})
}
if err != nil {
t.Fatalf("Error on subscribe: %v", err)
select {
case errCh <- fmt.Errorf("Error on subscribe: %v", err):
return
default:
}
}
defer sub.Unsubscribe()
time.Sleep(opts.MaxInactivity + 50*time.Millisecond)
Expand All @@ -572,6 +582,11 @@ func TestMaxInactivity(t *testing.T) {
go checkChannelNotDeletedDueToSub("c3", "", "dur")
go checkChannelNotDeletedDueToSub("c4", "queue", "dur")
wg.Wait()
select {
case e := <-errCh:
t.Fatal(e.Error())
default:
}
// Since last subscription is closed, wait more than
// MaxInactivity, all those channels should have been deleted
time.Sleep(opts.MaxInactivity + 50*time.Millisecond)
Expand Down
11 changes: 9 additions & 2 deletions util/lockfile_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017-2018 The NATS Authors
// Copyright 2017-2019 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand All @@ -15,6 +15,7 @@ package util

import (
"flag"
"fmt"
"os"
"os/exec"
"strings"
Expand Down Expand Up @@ -99,12 +100,13 @@ func TestLockFile(t *testing.T) {
// Try again with different process, it should work now.
wg := sync.WaitGroup{}
wg.Add(1)
errCh := make(chan error, 1)
go func() {
defer wg.Done()
out, err := exec.Command(os.Args[0], "-lockFile", fname,
"-test.v", "-test.run=TestLockFile$").CombinedOutput()
if err != nil {
t.Fatalf("Other process should have been able to get the lock, got %v - %v",
errCh <- fmt.Errorf("Other process should have been able to get the lock, got %v - %v",
err, out)
}
}()
Expand All @@ -130,6 +132,11 @@ func TestLockFile(t *testing.T) {
wf.Close()
defer os.Remove(wf.Name())
wg.Wait()
select {
case e := <-errCh:
t.Fatal(e.Error())
default:
}
}
}

Expand Down

0 comments on commit 8ce1a7e

Please sign in to comment.