Skip to content

Commit

Permalink
Merge pull request #1288 from nats-io/release_0_25_4
Browse files Browse the repository at this point in the history
Release v0.25.4
  • Loading branch information
kozlovic authored Apr 17, 2023
2 parents 4cfa4f1 + f644961 commit 9b0fea8
Show file tree
Hide file tree
Showing 19 changed files with 124 additions and 173 deletions.
8 changes: 4 additions & 4 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ changelog:
skip: true

builds:
- main: ./nats-streaming-server.go
- main: .
binary: nats-streaming-server
flags:
- -trimpath
ldflags:
- -w -X github.com/nats-io/nats-streaming-server/server.gitCommit={{.ShortCommit}} -X github.com/nats-io/nats-server/v2/server.gitCommit=23ffc16
- -w -X github.com/nats-io/nats-streaming-server/server.gitCommit={{.ShortCommit}} -X github.com/nats-io/nats-server/v2/server.gitCommit=f84ca24
env:
- GO111MODULE=on
- CGO_ENABLED=0
Expand Down Expand Up @@ -47,14 +49,12 @@ nfpms:

archives:
- name_template: '{{.ProjectName}}-{{.Tag}}-{{.Os}}-{{.Arch}}{{if .Arm}}{{.Arm}}{{end}}'
rlcp: true
wrap_in_directory: true
format: zip
files:
- README.md
- LICENSE
- name_template: '{{.ProjectName}}-{{.Tag}}-{{.Os}}-{{.Arch}}{{if .Arm}}{{.Arm}}{{end}}'
rlcp: true
id: targz-archives
wrap_in_directory: true
format: tar.gz
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ under the Apache Version 2.0 license found in the LICENSE file.
[Coverage-image]: https://coveralls.io/repos/github/nats-io/nats-streaming-server/badge.svg?branch=main&t=kIxrDE
[ReportCard-Url]: http://goreportcard.com/report/nats-io/nats-streaming-server
[ReportCard-Image]: http://goreportcard.com/badge/github.com/nats-io/nats-streaming-server
[Release-Url]: https://github.com/nats-io/nats-streaming-server/releases/tag/v0.25.3
[Release-image]: https://img.shields.io/badge/release-v0.25.3-1eb0fc.svg
[Release-Url]: https://github.com/nats-io/nats-streaming-server/releases/tag/v0.25.4
[Release-image]: https://img.shields.io/badge/release-v0.25.4-1eb0fc.svg
[github-release]: https://github.com/nats-io/nats-streaming-server/releases/
29 changes: 22 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
module github.com/nats-io/nats-streaming-server

go 1.14
go 1.19

require (
github.com/go-sql-driver/mysql v1.7.0
github.com/gogo/protobuf v1.3.2
github.com/hashicorp/go-hclog v1.5.0
github.com/hashicorp/go-msgpack/v2 v2.1.0
github.com/hashicorp/raft v1.4.0
github.com/lib/pq v1.10.7
github.com/nats-io/nats-server/v2 v2.9.15
github.com/lib/pq v1.10.8
github.com/nats-io/nats-server/v2 v2.9.16
github.com/nats-io/nats.go v1.25.0
github.com/nats-io/nuid v1.0.1
github.com/nats-io/stan.go v0.10.4
github.com/prometheus/procfs v0.8.0
go.etcd.io/bbolt v1.3.6
golang.org/x/crypto v0.6.0
golang.org/x/sys v0.5.0
github.com/prometheus/procfs v0.9.0
go.etcd.io/bbolt v1.3.7
golang.org/x/crypto v0.8.0
golang.org/x/sys v0.7.0
)

require (
github.com/armon/go-metrics v0.4.1 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/hashicorp/go-immutable-radix v1.0.0 // indirect
github.com/hashicorp/go-msgpack v0.5.5 // indirect
github.com/hashicorp/golang-lru v0.5.0 // indirect
github.com/klauspost/compress v1.16.4 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/minio/highwayhash v1.0.2 // indirect
github.com/nats-io/jwt/v2 v2.4.1 // indirect
github.com/nats-io/nkeys v0.4.4 // indirect
golang.org/x/time v0.3.0 // indirect
)
95 changes: 16 additions & 79 deletions go.sum

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions logger/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"errors"
"flag"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -177,7 +176,7 @@ func TestLogger(t *testing.T) {
checkLogger("Unable to close logger: dummy error")

// Switch to file log
tmpDir, err := ioutil.TempDir("", "")
tmpDir, err := os.MkdirTemp("", "")
if err != nil {
t.Fatalf("Unable to create temp dir: %v", err)
}
Expand All @@ -188,7 +187,7 @@ func TestLogger(t *testing.T) {
logger.SetFileSizeLimit(1000)
// Reopen and check file content
logger.ReopenLogFile()
buf, err := ioutil.ReadFile(fname)
buf, err := os.ReadFile(fname)
if err != nil {
t.Fatalf("Error reading file: %v", err)
}
Expand All @@ -201,7 +200,7 @@ func TestLogger(t *testing.T) {
for i := 0; i < 100; i++ {
logger.Noticef(notice)
}
files, err := ioutil.ReadDir(tmpDir)
files, err := os.ReadDir(tmpDir)
if err != nil {
t.Fatalf("Unable to read temp dir: %v", err)
}
Expand Down
9 changes: 4 additions & 5 deletions server/clustering_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"database/sql"
"encoding/json"
"fmt"
"io/ioutil"
"math/rand"
"net"
"net/http"
Expand Down Expand Up @@ -46,7 +45,7 @@ import (
var defaultRaftLog string

func init() {
tmpDir, err := ioutil.TempDir("", "raft_logs_")
tmpDir, err := os.MkdirTemp("", "raft_logs_")
if err != nil {
panic("Could not create tmp dir")
}
Expand Down Expand Up @@ -3679,7 +3678,7 @@ func TestClusteringRaftLogReplayDoesNotDeleteLatestVersionOfChannel(t *testing.T
follower := removeServer(servers, leader)[0]
follower.Shutdown()
witnessFile := filepath.Join(follower.opts.FilestoreDir, channel, "deleted.txt")
if err := ioutil.WriteFile(witnessFile, []byte("if present, channel has not been deleted then recreated"), 0666); err != nil {
if err := os.WriteFile(witnessFile, []byte("if present, channel has not been deleted then recreated"), 0666); err != nil {
t.Fatalf("Error creating file: %v", err)
}
// Now restart..
Expand Down Expand Up @@ -4551,7 +4550,7 @@ func TestClusteringWithCryptoStore(t *testing.T) {

check := func(t *testing.T, name, fname string) {
t.Helper()
content, err := ioutil.ReadFile(fname)
content, err := os.ReadFile(fname)
if err != nil {
t.Fatalf("Error reading file %q: %v", fname1, err)
}
Expand Down Expand Up @@ -6770,7 +6769,7 @@ func TestClusteringRestoreSnapshotMsgsBailIfNoLeader(t *testing.T) {
return nil
})

snaps, err := ioutil.ReadDir(filepath.Join(defaultRaftLog, "c", clusterName, "snapshots"))
snaps, err := os.ReadDir(filepath.Join(defaultRaftLog, "c", clusterName, "snapshots"))
if err != nil {
t.Fatalf("Error reading snapshots directory: %v", err)
}
Expand Down
23 changes: 11 additions & 12 deletions server/conf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package server
import (
"bytes"
"flag"
"io/ioutil"
"os"
"reflect"
"runtime"
Expand Down Expand Up @@ -314,11 +313,11 @@ func TestParsePermError(t *testing.T) {
if runtime.GOOS == "windows" {
t.SkipNow()
}
tmpDir, err := ioutil.TempDir("", "streaming")
tmpDir, err := os.MkdirTemp("", "streaming")
if err != nil {
t.Fatalf("Could not create tmp dir: %v", err)
}
file, err := ioutil.TempFile(tmpDir, "config.conf")
file, err := os.CreateTemp(tmpDir, "config.conf")
if err != nil {
t.Fatalf("Could not create tmp file: %v", err)
}
Expand All @@ -339,7 +338,7 @@ func TestParsePermError(t *testing.T) {

func TestParseParserError(t *testing.T) {
confFile := "wrong_config.conf"
if err := ioutil.WriteFile(confFile, []byte("x=."), 0660); err != nil {
if err := os.WriteFile(confFile, []byte("x=."), 0660); err != nil {
t.Fatalf("Unexpected error creating conf file: %v", err)
}
defer os.Remove(confFile)
Expand All @@ -351,7 +350,7 @@ func TestParseParserError(t *testing.T) {

func TestParseStoreType(t *testing.T) {
confFile := "wrong_config.conf"
if err := ioutil.WriteFile(confFile, []byte("store=memory"), 0660); err != nil {
if err := os.WriteFile(confFile, []byte("store=memory"), 0660); err != nil {
t.Fatalf("Unexpected error creating conf file: %v", err)
}
defer os.Remove(confFile)
Expand All @@ -364,7 +363,7 @@ func TestParseStoreType(t *testing.T) {
}
os.Remove(confFile)

if err := ioutil.WriteFile(confFile, []byte("store=xyz"), 0660); err != nil {
if err := os.WriteFile(confFile, []byte("store=xyz"), 0660); err != nil {
t.Fatalf("Unexpected error creating conf file: %v", err)
}
defer os.Remove(confFile)
Expand All @@ -380,7 +379,7 @@ func TestParseStoreType(t *testing.T) {
stores.TypeSQL,
}
for _, gs := range goodStores {
if err := ioutil.WriteFile(confFile, []byte("store="+gs), 0660); err != nil {
if err := os.WriteFile(confFile, []byte("store="+gs), 0660); err != nil {
t.Fatalf("Unexpected error creating conf file: %v", err)
}
defer os.Remove(confFile)
Expand All @@ -398,7 +397,7 @@ func TestParseStoreType(t *testing.T) {
func TestParsePerChannelLimitsSetToZero(t *testing.T) {
confFile := "config.conf"
defer os.Remove(confFile)
if err := ioutil.WriteFile(confFile,
if err := os.WriteFile(confFile,
[]byte("store_limits: {channels: {foo: {max_msgs: 0, max_bytes: 0, max_age: \"0\", max_subs: 0, max_inactivity: \"0\"}}}"), 0660); err != nil {
t.Fatalf("Unexpected error creating conf file: %v", err)
}
Expand Down Expand Up @@ -532,7 +531,7 @@ func TestParseWrongTypes(t *testing.T) {

func expectFailureFor(t *testing.T, content, errorMatch string) {
confFile := "wrong_config.conf"
if err := ioutil.WriteFile(confFile, []byte(content), 0660); err != nil {
if err := os.WriteFile(confFile, []byte(content), 0660); err != nil {
t.Fatalf("Unexpected error creating conf file: %v", err)
}
defer os.Remove(confFile)
Expand Down Expand Up @@ -637,15 +636,15 @@ func TestParseConfigureOptions(t *testing.T) {
streaming: {
cluster_id: my_cluster
}`)
if err := ioutil.WriteFile(sconf, scontent, 0660); err != nil {
if err := os.WriteFile(sconf, scontent, 0660); err != nil {
t.Fatalf("Error creating conf file: %v", err)
}
ncontent := []byte(`
port: 5223
streaming: {
cluster_id: my_cluster_2
}`)
if err := ioutil.WriteFile(nconf, ncontent, 0660); err != nil {
if err := os.WriteFile(nconf, ncontent, 0660); err != nil {
t.Fatalf("Error creating conf file: %v", err)
}
sopts, nopts := mustNotFail([]string{"-sc", sconf, "-c", nconf})
Expand Down Expand Up @@ -700,7 +699,7 @@ func TestParseConfigureOptions(t *testing.T) {
} else {
ncontent = []byte(`logtime: true`)
}
if err := ioutil.WriteFile(nconf, ncontent, 0660); err != nil {
if err := os.WriteFile(nconf, ncontent, 0660); err != nil {
t.Fatalf("Error creating conf file: %v", err)
}
_, nopts = mustNotFail([]string{"-c", nconf})
Expand Down
9 changes: 5 additions & 4 deletions server/monitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ import (
"crypto/x509"
"encoding/json"
"fmt"
"io/ioutil"
"io"
"math/rand"
"net/http"
"os"
"reflect"
"runtime"
"strings"
Expand Down Expand Up @@ -81,7 +82,7 @@ func getBodyEx(t *testing.T, client *http.Client, scheme, endpoint string, mp, e
if ct != expectedContentType {
stackFatalf(t, "Expected %s content-type, got %s\n", expectedContentType, ct)
}
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
resp.Body.Close()
stackFatalf(t, "Got an error reading the body: %v\n", err)
Expand Down Expand Up @@ -155,7 +156,7 @@ func TestMonitorStartOwnHTTPSServer(t *testing.T) {
defer s.Shutdown()

tlsConfig := &tls.Config{}
caCert, err := ioutil.ReadFile("../test/certs/ca.pem")
caCert, err := os.ReadFile("../test/certs/ca.pem")
if err != nil {
t.Fatalf("Got error reading RootCA file: %s", err)
}
Expand Down Expand Up @@ -1494,7 +1495,7 @@ func TestMonitorNoPanicOnServerRestart(t *testing.T) {
if err != nil {
continue
}
ioutil.ReadAll(resp.Body)
io.ReadAll(resp.Body)
resp.Body.Close()
select {
case <-done:
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.25.3"
VERSION = "0.25.4"

DefaultClusterID = "test-cluster"
DefaultDiscoverPrefix = "_STAN.discover"
Expand Down
9 changes: 4 additions & 5 deletions server/server_run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"crypto/tls"
"flag"
"fmt"
"io/ioutil"
"os"
"reflect"
"runtime"
Expand Down Expand Up @@ -1283,12 +1282,12 @@ func TestStreamingServerReadyLog(t *testing.T) {
}

func TestReopenLogFileStopsNATSDebugTrace(t *testing.T) {
tmpDir, err := ioutil.TempDir("", "nats-streaming-server")
tmpDir, err := os.MkdirTemp("", "nats-streaming-server")
if err != nil {
t.Fatal("Could not create tmp dir")
}
defer os.RemoveAll(tmpDir)
file, err := ioutil.TempFile(tmpDir, "log_")
file, err := os.CreateTemp(tmpDir, "log_")
if err != nil {
t.Fatalf("Could not create the temp file: %v", err)
}
Expand All @@ -1311,7 +1310,7 @@ func TestReopenLogFileStopsNATSDebugTrace(t *testing.T) {

check := func(str string, expected bool) {
t.Helper()
buf, err := ioutil.ReadFile(nOpts.LogFile)
buf, err := os.ReadFile(nOpts.LogFile)
if err != nil {
t.Fatalf("Error reading file: %v", err)
}
Expand Down Expand Up @@ -1352,7 +1351,7 @@ func TestReopenLogFileStopsNATSDebugTrace(t *testing.T) {
s.log.Noticef(pstr)
}
// Check that size limit has been applied.
files, err := ioutil.ReadDir(tmpDir)
files, err := os.ReadDir(tmpDir)
if err != nil {
t.Fatalf("Error reading directory: %v", err)
}
Expand Down
9 changes: 4 additions & 5 deletions server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"errors"
"flag"
"fmt"
"io/ioutil"
"os"
"reflect"
"regexp"
Expand Down Expand Up @@ -162,7 +161,7 @@ func TestMain(m *testing.M) {
}

func init() {
tmpDir, err := ioutil.TempDir(".", "data_server_")
tmpDir, err := os.MkdirTemp(".", "data_server_")
if err != nil {
panic("Could not create tmp dir")
}
Expand Down Expand Up @@ -409,13 +408,13 @@ func createConnectionWithNatsOpts(t tLogger, clientName string,

func createConfFile(t *testing.T, content []byte) string {
t.Helper()
conf, err := ioutil.TempFile("", "")
conf, err := os.CreateTemp("", "")
if err != nil {
t.Fatalf("Error creating conf file: %v", err)
}
fName := conf.Name()
conf.Close()
if err := ioutil.WriteFile(fName, content, 0666); err != nil {
if err := os.WriteFile(fName, content, 0666); err != nil {
os.Remove(fName)
t.Fatalf("Error writing conf file: %v", err)
}
Expand All @@ -424,7 +423,7 @@ func createConfFile(t *testing.T, content []byte) string {

func changeCurrentConfigContentWithNewContent(t *testing.T, curConfig string, content []byte) {
t.Helper()
if err := ioutil.WriteFile(curConfig, content, 0666); err != nil {
if err := os.WriteFile(curConfig, content, 0666); err != nil {
t.Fatalf("Error writing config: %v", err)
}
}
Expand Down
Loading

0 comments on commit 9b0fea8

Please sign in to comment.