From a76742833c649c936b1226d6ff1b2ab9f3acf879 Mon Sep 17 00:00:00 2001 From: Aaron Jacobs Date: Fri, 1 May 2015 11:11:32 +1000 Subject: [PATCH] Plumb through the ogletest context. --- samples/in_process.go | 5 +++-- samples/subprocess.go | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/samples/in_process.go b/samples/in_process.go index ae78210..4cb8dcf 100644 --- a/samples/in_process.go +++ b/samples/in_process.go @@ -59,7 +59,7 @@ type SampleTest struct { // // REQUIRES: t.Server has been set. func (t *SampleTest) SetUp(ti *ogletest.TestInfo) { - err := t.initialize(t.Server, &t.MountConfig) + err := t.initialize(ti.Ctx, t.Server, &t.MountConfig) if err != nil { panic(err) } @@ -67,10 +67,11 @@ func (t *SampleTest) SetUp(ti *ogletest.TestInfo) { // Like SetUp, but doens't panic. func (t *SampleTest) initialize( + ctx context.Context, server fuse.Server, config *fuse.MountConfig) (err error) { // Initialize the context. - t.Ctx = context.Background() + t.Ctx = ctx // Initialize the clock. t.Clock.SetTime(time.Date(2012, 8, 15, 22, 56, 0, 0, time.Local)) diff --git a/samples/subprocess.go b/samples/subprocess.go index 510c0ab..08f88fa 100644 --- a/samples/subprocess.go +++ b/samples/subprocess.go @@ -68,7 +68,7 @@ type SubprocessTest struct { // Mount the file system and initialize the other exported fields of the // struct. Panics on error. func (t *SubprocessTest) SetUp(ti *ogletest.TestInfo) { - err := t.initialize() + err := t.initialize(ti.Ctx) if err != nil { panic(err) } @@ -184,9 +184,9 @@ func waitForReady(readyReader *os.File, c chan<- struct{}) { } // Like SetUp, but doens't panic. -func (t *SubprocessTest) initialize() (err error) { +func (t *SubprocessTest) initialize(ctx context.Context) (err error) { // Initialize the context. - t.Ctx = context.Background() + t.Ctx = ctx // Set up a temporary directory. t.Dir, err = ioutil.TempDir("", "sample_test")