Skip to content

Commit

Permalink
Add test suite to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
dennis-tra committed Feb 25, 2021
1 parent 961d64f commit 99d184e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
- uses: actions/setup-go@v2
with:
go-version: '^1.15.6'
- name: Running test suite
run: make test
- name: Building release binaries
run: make release
- name: Creating Release
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
BINARY=pcp
VERSION=0.3.0
VERSION=0.3.1
BUILD=`git rev-parse HEAD`
PLATFORMS=darwin linux windows
ARCHITECTURES=386 amd64 arm
Expand All @@ -11,6 +11,9 @@ default: build

all: clean release install

test:
go test ./...

build:
go build ${LDFLAGS} -o out/${BINARY} cmd/pcp/pcp.go

Expand Down
7 changes: 6 additions & 1 deletion pkg/dht/discoverer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"testing"
"time"

mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"

"github.com/golang/mock/gomock"
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p-core/peer"
Expand Down Expand Up @@ -182,7 +184,10 @@ func TestDiscoverer_Discover_restartAsSoonAsCurrentTimeSlotIsExpired(t *testing.
}

func TestDiscoverer_SetOffset(t *testing.T) {
d := NewDiscoverer(nil, nil)
net := mocknet.New(context.Background())
local, err := net.GenPeer()
require.NoError(t, err)
d := NewDiscoverer(local, nil)
id1 := d.DiscoveryID(333)
d.SetOffset(TruncateDuration * 3)
id2 := d.DiscoveryID(333)
Expand Down

0 comments on commit 99d184e

Please sign in to comment.