Skip to content

Commit

Permalink
Run tests in parrallel
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklaw5 committed Apr 7, 2018
1 parent 3a4e2aa commit f6cd63a
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 9 deletions.
16 changes: 8 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ language: go
sudo: false

go:
- 1.7.x
- 1.8.x
- 1.9.x
- 1.10.x
- 1.7.x
- 1.8.x
- 1.9.x
- 1.10.x

before_install:
- go get golang.org/x/tools/cmd/cover
- go get github.com/mattn/goveralls
- go get golang.org/x/tools/cmd/cover
- go get github.com/mattn/goveralls

script:
- go test -v -covermode=count -coverprofile=coverage.out
- $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci
- go test -v -parallel=10 -covermode=count -coverprofile=coverage.out
- $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci
22 changes: 22 additions & 0 deletions error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ type Error struct {
}

func TestBadRequest(t *testing.T) {
t.Parallel()

req := newRequest(t, "GET")

rr := httptest.NewRecorder()
Expand All @@ -34,6 +36,8 @@ func TestBadRequest(t *testing.T) {
}

func TestUnauthorized(t *testing.T) {
t.Parallel()

req := newRequest(t, "GET")

rr := httptest.NewRecorder()
Expand All @@ -54,6 +58,8 @@ func TestUnauthorized(t *testing.T) {
}

func TestForbidden(t *testing.T) {
t.Parallel()

req := newRequest(t, "GET")

rr := httptest.NewRecorder()
Expand All @@ -74,6 +80,8 @@ func TestForbidden(t *testing.T) {
}

func TestNotFound(t *testing.T) {
t.Parallel()

req := newRequest(t, "GET")

rr := httptest.NewRecorder()
Expand All @@ -94,6 +102,8 @@ func TestNotFound(t *testing.T) {
}

func TestMethodNotAllowed(t *testing.T) {
t.Parallel()

req := newRequest(t, "GET")

rr := httptest.NewRecorder()
Expand All @@ -114,6 +124,8 @@ func TestMethodNotAllowed(t *testing.T) {
}

func TestConflict(t *testing.T) {
t.Parallel()

req := newRequest(t, "POST")

rr := httptest.NewRecorder()
Expand All @@ -134,6 +146,8 @@ func TestConflict(t *testing.T) {
}

func TestLengthRequired(t *testing.T) {
t.Parallel()

req := newRequest(t, "POST")

rr := httptest.NewRecorder()
Expand All @@ -154,6 +168,8 @@ func TestLengthRequired(t *testing.T) {
}

func TestPreconditionFailed(t *testing.T) {
t.Parallel()

req := newRequest(t, "POST")

rr := httptest.NewRecorder()
Expand All @@ -174,6 +190,8 @@ func TestPreconditionFailed(t *testing.T) {
}

func TestUnprocessableEntity(t *testing.T) {
t.Parallel()

req := newRequest(t, "POST")

rr := httptest.NewRecorder()
Expand All @@ -194,6 +212,8 @@ func TestUnprocessableEntity(t *testing.T) {
}

func TestInternalServerError(t *testing.T) {
t.Parallel()

req := newRequest(t, "POST")

rr := httptest.NewRecorder()
Expand All @@ -214,6 +234,8 @@ func TestInternalServerError(t *testing.T) {
}

func TestNotImplemented(t *testing.T) {
t.Parallel()

req := newRequest(t, "POST")

rr := httptest.NewRecorder()
Expand Down
8 changes: 7 additions & 1 deletion response_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ func validateResponseHeader(responseHeaderValue string, expectedHeaderValue stri
return nil
}

func TestContentTyoeHeader(t *testing.T) {
func TestContentTypeHeader(t *testing.T) {
t.Parallel()

req := newRequest(t, "POST")

rr := httptest.NewRecorder()
Expand All @@ -59,6 +61,8 @@ func TestContentTyoeHeader(t *testing.T) {
}

func TestAddHeader(t *testing.T) {
t.Parallel()

req := newRequest(t, "POST")

rr := httptest.NewRecorder()
Expand All @@ -80,6 +84,8 @@ func TestAddHeader(t *testing.T) {
}

func TestDeleteHeader(t *testing.T) {
t.Parallel()

req := newRequest(t, "GET")

rr := httptest.NewRecorder()
Expand Down
8 changes: 8 additions & 0 deletions success_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
)

func TestOk(t *testing.T) {
t.Parallel()

req := newRequest(t, "GET")

rr := httptest.NewRecorder()
Expand All @@ -34,6 +36,8 @@ type User struct {
}

func TestCreated(t *testing.T) {
t.Parallel()

req := newRequest(t, "POST")

rr := httptest.NewRecorder()
Expand All @@ -60,6 +64,8 @@ func TestCreated(t *testing.T) {
}

func TestAccepted(t *testing.T) {
t.Parallel()

req := newRequest(t, "POST")

rr := httptest.NewRecorder()
Expand All @@ -79,6 +85,8 @@ func TestAccepted(t *testing.T) {
}

func TestNoContent(t *testing.T) {
t.Parallel()

req := newRequest(t, "POST")

rr := httptest.NewRecorder()
Expand Down

0 comments on commit f6cd63a

Please sign in to comment.