Skip to content

Commit

Permalink
Merge 395cbc3 into e0a939b
Browse files Browse the repository at this point in the history
  • Loading branch information
kozlovic committed Mar 12, 2020
2 parents e0a939b + 395cbc3 commit da55209
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 17 deletions.
40 changes: 26 additions & 14 deletions .travis.yml
@@ -1,3 +1,6 @@
os:
- linux
- windows
language: go
sudo: false
go:
Expand All @@ -13,24 +16,33 @@ go_import_path: github.com/nats-io/nats-streaming-server
install:
- go get -t ./...
- go get github.com/nats-io/nats-server
- go get -u honnef.co/go/tools/cmd/staticcheck
- go get -u github.com/client9/misspell/cmd/misspell
- go get -u github.com/go-sql-driver/mysql
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
go get -u honnef.co/go/tools/cmd/staticcheck;
go get -u github.com/client9/misspell/cmd/misspell;
go get -u github.com/go-sql-driver/mysql;
fi
services:
- mysql
before_script:
# Remove the "spb" directory that contains protobuf
- GO_LIST=$(go list ./... | grep -v "/spb")
- go install
- $(exit $(go fmt $GO_LIST | wc -l))
- go vet $GO_LIST
- find . -type f -name "*.go" | grep -v "/vendor/" | grep -v "/spb/" | xargs misspell -error -locale US
- staticcheck $GO_LIST
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
GO_LIST=$(go list ./... | grep -v "/spb");
go install;
$(exit $(go fmt $GO_LIST | wc -l));
go vet $GO_LIST;
find . -type f -name "*.go" | grep -v "/vendor/" | grep -v "/spb/" | xargs misspell -error -locale US;
staticcheck $GO_LIST;
fi
script:
- set -e
- mysql -u root -e "CREATE USER 'nss'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'nss'@'localhost'; CREATE DATABASE test_nats_streaming;"
- go test -i ./...
- if [[ "$TRAVIS_GO_VERSION" =~ 1.13 ]]; then ./scripts/cov.sh TRAVIS; else go test -v -failfast -p=1 ./...; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
mysql -u root -e "CREATE USER 'nss'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'nss'@'localhost'; CREATE DATABASE test_nats_streaming;";
go test -i ./...;
if [[ "$TRAVIS_GO_VERSION" =~ 1.13 ]]; then ./scripts/cov.sh TRAVIS; else go test -v -failfast -p=1 ./...; fi;
fi
- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
go install;
go test -v -p=1 ./... -count=1 -sql=false -failfast;
fi
- set +e

deploy:
Expand All @@ -40,4 +52,4 @@ deploy:
verbose: true
on:
tags: true
condition: $TRAVIS_GO_VERSION =~ 1.13
condition: ("$TRAVIS_OS_NAME" = "linux") && ("$TRAVIS_GO_VERSION" =~ "1.13")
1 change: 1 addition & 0 deletions server/clustering_test.go
Expand Up @@ -1129,6 +1129,7 @@ func TestClusteringLogSnapshotRestoreAfterChannelLimitHit(t *testing.T) {
s1sOpts := getTestDefaultOptsForClustering("a", true)
s1sOpts.Clustering.TrailingLogs = 0
s1sOpts.MaxMsgs = 20
s1sOpts.Clustering.LogSnapshots = 2
s1 := runServerWithOpts(t, s1sOpts, nil)
defer s1.Shutdown()

Expand Down
9 changes: 6 additions & 3 deletions server/server_run_test.go
Expand Up @@ -78,6 +78,9 @@ func TestRunServerFailureLogsCause(t *testing.T) {
}

func TestServerLoggerDebugAndTrace(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip()
}
sOpts := GetDefaultOptions()
sOpts.EnableLogging = true
sOpts.Debug = true
Expand All @@ -91,19 +94,19 @@ func TestServerLoggerDebugAndTrace(t *testing.T) {
}()
os.Stderr = w
done := make(chan bool, 1)
buf := make([]byte, 1024)
buf := make([]byte, 10000)
out := make([]byte, 0)
wg := sync.WaitGroup{}
wg.Add(1)
go func() {
defer wg.Done()
for {
n, _ := r.Read(buf)
out = append(out, buf[:n]...)
select {
case <-done:
return
default:
n, _ := r.Read(buf)
out = append(out, buf[:n]...)
}
}
}()
Expand Down
4 changes: 4 additions & 0 deletions stores/filestore_sub_test.go
Expand Up @@ -18,6 +18,7 @@ import (
"os"
"path/filepath"
"reflect"
"runtime"
"testing"
"time"

Expand Down Expand Up @@ -559,6 +560,9 @@ func TestFSCompactSubsUpdateLastSent(t *testing.T) {
}

func TestFSSubStoreVariousBufferSizes(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip()
}
cleanupFSDatastore(t)
defer cleanupFSDatastore(t)

Expand Down

0 comments on commit da55209

Please sign in to comment.