fix cli tests (#609)

- add pruning config
- add the new build path
This commit is contained in:
Ruaridh 2020-09-01 16:36:47 +01:00 committed by GitHub
parent 3e4e2ff659
commit 0504f55e26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 19 deletions

View File

@ -3,18 +3,6 @@
VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//') VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
COMMIT := $(shell git log -1 --format='%H') COMMIT := $(shell git log -1 --format='%H')
LEDGER_ENABLED ?= true LEDGER_ENABLED ?= true
ifeq ($(DETECTED_OS),)
ifeq ($(OS),Windows_NT)
DETECTED_OS := windows
else
UNAME_S = $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
DETECTED_OS := mac
else
DETECTED_OS := linux
endif
endif
endif
export GO111MODULE = on export GO111MODULE = on
# process build tags # process build tags
@ -76,15 +64,15 @@ all: install
build: go.sum build: go.sum
ifeq ($(OS), Windows_NT) ifeq ($(OS), Windows_NT)
go build -mod=readonly $(BUILD_FLAGS) -o build/$(DETECTED_OS)/kvd.exe ./cmd/kvd go build -mod=readonly $(BUILD_FLAGS) -o build/$(shell go env GOOS)/kvd.exe ./cmd/kvd
go build -mod=readonly $(BUILD_FLAGS) -o build/$(DETECTED_OS)/kvcli.exe ./cmd/kvcli go build -mod=readonly $(BUILD_FLAGS) -o build/$(shell go env GOOS)/kvcli.exe ./cmd/kvcli
else else
go build -mod=readonly $(BUILD_FLAGS) -o build/$(DETECTED_OS)/kvd ./cmd/kvd go build -mod=readonly $(BUILD_FLAGS) -o build/$(shell go env GOOS)/kvd ./cmd/kvd
go build -mod=readonly $(BUILD_FLAGS) -o build/$(DETECTED_OS)/kvcli ./cmd/kvcli go build -mod=readonly $(BUILD_FLAGS) -o build/$(shell go env GOOS)/kvcli ./cmd/kvcli
endif endif
build-linux: go.sum build-linux: go.sum
LEDGER_ENABLED=false GOOS=linux GOARCH=amd64 DETECTED_OS=linux $(MAKE) build LEDGER_ENABLED=false GOOS=linux GOARCH=amd64 $(MAKE) build
install: go.sum install: go.sum
go install -mod=readonly $(BUILD_FLAGS) ./cmd/kvd go install -mod=readonly $(BUILD_FLAGS) ./cmd/kvd

View File

@ -6,6 +6,7 @@ import (
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"runtime"
"strings" "strings"
"testing" "testing"
"time" "time"
@ -102,7 +103,7 @@ func NewFixtures(t *testing.T) *Fixtures {
buildDir := os.Getenv("BUILDDIR") buildDir := os.Getenv("BUILDDIR")
if buildDir == "" { if buildDir == "" {
buildDir, err = filepath.Abs("../build/") buildDir, err = filepath.Abs(filepath.Join("../build/", runtime.GOOS))
require.NoError(t, err) require.NoError(t, err)
} }
@ -248,7 +249,7 @@ func (f *Fixtures) CollectGenTxs(flags ...string) {
// GDStart runs kavad start with the appropriate flags and returns a process // GDStart runs kavad start with the appropriate flags and returns a process
func (f *Fixtures) GDStart(flags ...string) *tests.Process { func (f *Fixtures) GDStart(flags ...string) *tests.Process {
cmd := fmt.Sprintf("%s start --home=%s --rpc.laddr=%v --p2p.laddr=%v", f.KvdBinary, f.KvdHome, f.RPCAddr, f.P2PAddr) cmd := fmt.Sprintf("%s start --home=%s --rpc.laddr=%v --p2p.laddr=%v --pruning=everything", f.KvdBinary, f.KvdHome, f.RPCAddr, f.P2PAddr)
proc := tests.GoExecuteTWithStdout(f.T, addFlags(cmd, flags)) proc := tests.GoExecuteTWithStdout(f.T, addFlags(cmd, flags))
tests.WaitForTMStart(f.Port) tests.WaitForTMStart(f.Port)
tests.WaitForNextNBlocksTM(1, f.Port) tests.WaitForNextNBlocksTM(1, f.Port)