From 0504f55e2650de660cd39052f8c3f5c2272a3afe Mon Sep 17 00:00:00 2001 From: Ruaridh Date: Tue, 1 Sep 2020 16:36:47 +0100 Subject: [PATCH] fix cli tests (#609) - add pruning config - add the new build path --- Makefile | 22 +++++----------------- cli_test/test_helpers.go | 5 +++-- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index ebe7480e..722a1bf4 100644 --- a/Makefile +++ b/Makefile @@ -3,18 +3,6 @@ VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//') COMMIT := $(shell git log -1 --format='%H') 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 # process build tags @@ -76,15 +64,15 @@ all: install build: go.sum 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/$(DETECTED_OS)/kvcli.exe ./cmd/kvcli + go build -mod=readonly $(BUILD_FLAGS) -o build/$(shell go env GOOS)/kvd.exe ./cmd/kvd + go build -mod=readonly $(BUILD_FLAGS) -o build/$(shell go env GOOS)/kvcli.exe ./cmd/kvcli else - go build -mod=readonly $(BUILD_FLAGS) -o build/$(DETECTED_OS)/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)/kvd ./cmd/kvd + go build -mod=readonly $(BUILD_FLAGS) -o build/$(shell go env GOOS)/kvcli ./cmd/kvcli endif 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 go install -mod=readonly $(BUILD_FLAGS) ./cmd/kvd diff --git a/cli_test/test_helpers.go b/cli_test/test_helpers.go index f7c1b43f..72427a2e 100644 --- a/cli_test/test_helpers.go +++ b/cli_test/test_helpers.go @@ -6,6 +6,7 @@ import ( "io/ioutil" "os" "path/filepath" + "runtime" "strings" "testing" "time" @@ -102,7 +103,7 @@ func NewFixtures(t *testing.T) *Fixtures { buildDir := os.Getenv("BUILDDIR") if buildDir == "" { - buildDir, err = filepath.Abs("../build/") + buildDir, err = filepath.Abs(filepath.Join("../build/", runtime.GOOS)) 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 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)) tests.WaitForTMStart(f.Port) tests.WaitForNextNBlocksTM(1, f.Port)