diff options
| author | Andrew Phelps <136256549+andrewphelpsj@users.noreply.github.com> | 2023-09-20 09:31:46 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-20 15:31:46 +0200 |
| commit | c67974c6952799cddbf7671129bf05b354b3464c (patch) | |
| tree | 3e063dc2c9279a0168c651767fe9930a84483e9b | |
| parent | 619489d6ea9d4bb9a864b6bfbde5ba2fa77e7af8 (diff) | |
daemon: make tests pass with race detector (#13199)
* daemon: make tests pass with race detector * daemon: remove need for TearDownTest by using AddCleanup method to reset GlobalRootDir
| -rw-r--r-- | daemon/api_base_test.go | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/daemon/api_base_test.go b/daemon/api_base_test.go index a102fa13b1..2517df8608 100644 --- a/daemon/api_base_test.go +++ b/daemon/api_base_test.go @@ -201,6 +201,7 @@ func (s *apiBaseSuite) SetUpTest(c *check.C) { s.SysctlBufs = nil dirs.SetRootDir(c.MkDir()) + s.AddCleanup(func() { dirs.SetRootDir("") }) err := os.MkdirAll(filepath.Dir(dirs.SnapStateFile), 0755) restore := osutil.MockMountInfo("") s.AddCleanup(restore) @@ -216,6 +217,7 @@ func (s *apiBaseSuite) SetUpTest(c *check.C) { s.vars = nil s.user = nil s.d = nil + s.ctx = nil s.currentSnaps = nil s.actions = nil s.authUser = nil @@ -235,14 +237,6 @@ func (s *apiBaseSuite) SetUpTest(c *check.C) { s.Brands.Register("my-brand", brandPrivKey, nil) } -func (s *apiBaseSuite) TearDownTest(c *check.C) { - s.d = nil - s.ctx = nil - - dirs.SetRootDir("") - s.BaseTest.TearDownTest(c) -} - func (s *apiBaseSuite) mockModel(st *state.State, model *asserts.Model) { // realistic model setup if model == nil { |
