Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

itests/kit: add guard to ensure imports from tests only. #6445

Merged
merged 1 commit into from
Jun 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions itests/kit/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package kit
import (
"fmt"
"os"
"strings"

"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/build"
Expand All @@ -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))
Expand All @@ -22,4 +28,5 @@ func init() {
panic(fmt.Sprintf("failed to set BELLMAN_NO_GPU env variable: %s", err))
}
build.InsecurePoStValidation = true

}