Skip to content
This repository was archived by the owner on Apr 30, 2025. It is now read-only.

Commit 99d184e

Browse files
committed
Add test suite to CI
1 parent 961d64f commit 99d184e

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515
- uses: actions/setup-go@v2
1616
with:
1717
go-version: '^1.15.6'
18+
- name: Running test suite
19+
run: make test
1820
- name: Building release binaries
1921
run: make release
2022
- name: Creating Release

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
BINARY=pcp
2-
VERSION=0.3.0
2+
VERSION=0.3.1
33
BUILD=`git rev-parse HEAD`
44
PLATFORMS=darwin linux windows
55
ARCHITECTURES=386 amd64 arm
@@ -11,6 +11,9 @@ default: build
1111

1212
all: clean release install
1313

14+
test:
15+
go test ./...
16+
1417
build:
1518
go build ${LDFLAGS} -o out/${BINARY} cmd/pcp/pcp.go
1619

pkg/dht/discoverer_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import (
66
"testing"
77
"time"
88

9+
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
10+
911
"github.com/golang/mock/gomock"
1012
"github.com/ipfs/go-cid"
1113
"github.com/libp2p/go-libp2p-core/peer"
@@ -182,7 +184,10 @@ func TestDiscoverer_Discover_restartAsSoonAsCurrentTimeSlotIsExpired(t *testing.
182184
}
183185

184186
func TestDiscoverer_SetOffset(t *testing.T) {
185-
d := NewDiscoverer(nil, nil)
187+
net := mocknet.New(context.Background())
188+
local, err := net.GenPeer()
189+
require.NoError(t, err)
190+
d := NewDiscoverer(local, nil)
186191
id1 := d.DiscoveryID(333)
187192
d.SetOffset(TruncateDuration * 3)
188193
id2 := d.DiscoveryID(333)

0 commit comments

Comments
 (0)