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

[util][testutil] Add NO_IDE env check to skip check only runs in IDE #91

Open
at15 opened this issue Sep 17, 2018 · 0 comments
Open

[util][testutil] Add NO_IDE env check to skip check only runs in IDE #91

at15 opened this issue Sep 17, 2018 · 0 comments
Labels

Comments

@at15
Copy link
Member

at15 commented Sep 17, 2018

There are many ad-hoc unit tests that can only run in IDE (due to config, exec order etc.) and need to be skipped if the test is run in CI or just through makefile

Then in package's TestMain we can call TestPkg to enable/disable entire package, and if just a single func we can use tesutil.SkipIf(testutil.EnvTrue("NO_IDE"))

func TestPkg(pkg string) bool {
	pkgLock.Lock()
	defer pkgLock.Unlock()

	noIDE := os.Getenv("NO_IDE")
	if noIDE == "true" {
		log.Printf("test package %s is skipped, set NO_IDE=false to enable it, currently NO_IDE=%s", pkg, noIDE)
		return false
	}
}

in Makefile

GO = CGO_ENABLED=0 go
# NO_IDE is used to skip test or packages that are meant to run in IDE manually due to hard coded config
GOTEST = NO_IDE=true $(GO) test
@at15 at15 added the pkg/util label Sep 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant