Skip to content

Commit

Permalink
Add test ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Kananykhin committed May 10, 2023
1 parent 8fa7fbd commit 8965332
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Test
on: [push, pull_request]
jobs:
test:
name: Test with Coverage
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.18'
- name: Check out code
uses: actions/checkout@v2
- name: Install dependencies
run: |
go mod download
- name: Run Unit tests
run: |
go test -race -covermode atomic -coverprofile=covprofile ./...
- name: Install goveralls
run: go install github.com/mattn/goveralls@latest
- name: Send coverage
env:
COVERALLS_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: goveralls -coverprofile=covprofile -service=github
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
# Test binary, built with `go test -c`
*.test

# Test coverage
covprofile

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# buildbuildio/pebbles
[![Coverage Status](https://coveralls.io/repos/github/buildbuildio/pebbles/badge.svg?branch=main)](https://coveralls.io/github/buildbuildio/pebbles?branch=main)

pebbles is a GraphQL federation gateway.

Expand Down
7 changes: 4 additions & 3 deletions queryer/subscribe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"net/http"
"net/http/httptest"
"sync/atomic"
"testing"
"time"

Expand Down Expand Up @@ -132,9 +133,9 @@ func TestSubscribe(t *testing.T) {
}

func TestSubscribeErrorQuery(t *testing.T) {
var called int
var called atomic.Int32
testFn := func() {
called += 1
called.Add(1)
}

s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -217,7 +218,7 @@ func TestSubscribeErrorQuery(t *testing.T) {
assert.FailNow(t, "timeout")
}
closeCh <- struct{}{}
assert.Equal(t, 2, called)
assert.EqualValues(t, 2, called.Load())
}

func TestSubscribeErrorNoSupportForWs(t *testing.T) {
Expand Down

0 comments on commit 8965332

Please sign in to comment.