From 3afdd84a5c0cea217043e9d32ce61e9f6bccf18b Mon Sep 17 00:00:00 2001 From: "Joe Richey joerichey@google.com" Date: Tue, 18 Jul 2017 21:08:02 -0700 Subject: tests: Unit tests and Integration tests work Now the testing functions will skip the integration tests if a testing filesystem is not specified. --- actions/context_test.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'actions') diff --git a/actions/context_test.go b/actions/context_test.go index a92ef34..4b38a33 100644 --- a/actions/context_test.go +++ b/actions/context_test.go @@ -28,6 +28,7 @@ import ( "time" "github.com/google/fscrypt/util" + "github.com/pkg/errors" ) const testTime = 10 * time.Millisecond @@ -38,7 +39,7 @@ var testContext *Context // Makes a context using the testing locations for the filesystem and // configuration file. func setupContext() (ctx *Context, err error) { - mountpoint, err := util.TestPath() + mountpoint, err := util.TestRoot() if err != nil { return nil, err } @@ -83,8 +84,11 @@ func TestMain(m *testing.M) { var err error testContext, err = setupContext() if err != nil { - fmt.Printf("setupContext() = %v\n", err) - os.Exit(1) + fmt.Println(err) + if errors.Cause(err) != util.ErrSkipIntegration { + os.Exit(1) + } + os.Exit(0) } returnCode := m.Run() -- cgit v1.2.3