From d3fc6833a52f716f9bd4cb9d0a6fadfd1fe5e77f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Thu, 10 Jun 2021 12:05:35 +0100 Subject: [PATCH] itests/kit: add guard to ensure imports from tests only. --- itests/kit/init.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/itests/kit/init.go b/itests/kit/init.go index 57d60ad2a..2f40ca0f0 100644 --- a/itests/kit/init.go +++ b/itests/kit/init.go @@ -3,6 +3,7 @@ package kit import ( "fmt" "os" + "strings" "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/lotus/build" @@ -11,6 +12,11 @@ import ( ) func init() { + bin := os.Args[0] + if !strings.HasSuffix(bin, ".test") { + panic("package itests/kit must only be imported from tests") + } + _ = logging.SetLogLevel("*", "INFO") policy.SetConsensusMinerMinPower(abi.NewStoragePower(2048)) @@ -22,4 +28,5 @@ func init() { panic(fmt.Sprintf("failed to set BELLMAN_NO_GPU env variable: %s", err)) } build.InsecurePoStValidation = true + }