From a6670c74ef4661ccd263d4b9a04df48bc715e11c Mon Sep 17 00:00:00 2001 From: hwdef Date: Sun, 29 Sep 2019 15:39:02 +0800 Subject: [PATCH] fix(supernode/config): add error handling Signed-off-by: hwdef --- supernode/config/config_test.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/supernode/config/config_test.go b/supernode/config/config_test.go index a141cf42a..0383577d2 100644 --- a/supernode/config/config_test.go +++ b/supernode/config/config_test.go @@ -56,7 +56,8 @@ func (s *SupernodeConfigTestSuite) SetUpSuite(c *check.C) { func (s *SupernodeConfigTestSuite) TearDownSuite(c *check.C) { if s.workHome != "" { - os.RemoveAll(s.workHome) + err := os.RemoveAll(s.workHome) + c.Assert(err, check.IsNil) } } @@ -65,13 +66,16 @@ func (s *SupernodeConfigTestSuite) TestConfig_Load(c *check.C) { conf := NewConfig() exp := &Config{} - ioutil.WriteFile(confPath, []byte(conf.String()), os.ModePerm) - exp.Load(confPath) + err := ioutil.WriteFile(confPath, []byte(conf.String()), os.ModePerm) + c.Assert(err, check.IsNil) + err = exp.Load(confPath) + c.Assert(err, check.IsNil) c.Assert(conf.BaseProperties, check.DeepEquals, exp.BaseProperties) conf = &Config{} - ioutil.WriteFile(confPath, []byte(content), os.ModePerm) - err := conf.Load(confPath) + err = ioutil.WriteFile(confPath, []byte(content), os.ModePerm) + c.Assert(err, check.IsNil) + err = conf.Load(confPath) c.Assert(err, check.IsNil) c.Assert(conf.HomeDir, check.Equals, "/tmp") c.Assert(conf.Plugins[StoragePlugin], check.NotNil)