Skip to content

Commit

Permalink
Removed need for ignore check on staticcheck, added misspell check
Browse files Browse the repository at this point in the history
  • Loading branch information
derekcollison committed Apr 21, 2017
1 parent 345b463 commit ddd1b47
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@ language: go
go:
- 1.6.4
- 1.7.5
- 1.8
- 1.8.1
install:
- go get github.com/nats-io/go-nats
- go get github.com/mattn/goveralls
- go get github.com/wadey/gocovmerge
- go get honnef.co/go/tools/cmd/staticcheck
- go get honnef.co/go/tools/cmd/gosimple
- go get -u honnef.co/go/tools/cmd/staticcheck
- go get -u honnef.co/go/tools/cmd/gosimple
- go get -u github.com/client9/misspell/cmd/misspell
before_script:
- EXCLUDE_VENDOR=$(go list ./... | grep -v "/vendor/")
- go build
- go fmt ./...
- go vet $EXCLUDE_VENDOR
- gosimple $EXCLUDE_VENDOR
- staticcheck -ignore "$(cat staticcheck.ignore)" $EXCLUDE_VENDOR
- misspell -error -locale US $EXCLUDE_VENDOR
- staticcheck $EXCLUDE_VENDOR
script:
- go test -i -race $EXCLUDE_VENDOR
- go test -v -race $EXCLUDE_VENDOR
Expand Down
22 changes: 17 additions & 5 deletions server/monitor_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2015-2016 Apcera Inc. All rights reserved.
// Copyright 2015-2017 Apcera Inc. All rights reserved.

package server

Expand Down Expand Up @@ -1311,28 +1311,40 @@ func TestConcurrentMonitoring(t *testing.T) {
endpoints := []string{"varz", "varz", "varz", "connz", "connz", "subsz", "subsz", "routez", "routez"}
wg := &sync.WaitGroup{}
wg.Add(len(endpoints))
ech := make(chan string, len(endpoints))

for _, e := range endpoints {
go func(endpoint string) {
defer wg.Done()
for i := 0; i < 150; i++ {
resp, err := http.Get(url + endpoint)
if err != nil {
t.Fatalf("Expected no error: Got %v\n", err)
ech <- fmt.Sprintf("Expected no error: Got %v\n", err)
return
}
if resp.StatusCode != 200 {
t.Fatalf("Expected a 200 response, got %d\n", resp.StatusCode)
ech <- fmt.Sprintf("Expected a 200 response, got %d\n", resp.StatusCode)
return
}
ct := resp.Header.Get("Content-Type")
if ct != "application/json" {
t.Fatalf("Expected application/json content-type, got %s\n", ct)
ech <- fmt.Sprintf("Expected application/json content-type, got %s\n", ct)
return
}
defer resp.Body.Close()
if _, err := ioutil.ReadAll(resp.Body); err != nil {
t.Fatalf("Got an error reading the body: %v\n", err)
ech <- fmt.Sprintf("Got an error reading the body: %v\n", err)
return
}
resp.Body.Close()
}
}(e)
}
wg.Wait()
// Check for any errors
select {
case err := <-ech:
t.Fatal(err)
default:
}
}
2 changes: 0 additions & 2 deletions staticcheck.ignore

This file was deleted.

0 comments on commit ddd1b47

Please sign in to comment.