Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
fix(supernode/config): add error handling
Browse files Browse the repository at this point in the history
Signed-off-by: hwdef <[email protected]>
  • Loading branch information
hwdef committed Sep 29, 2019
1 parent 16169b3 commit a6670c7
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions supernode/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand All @@ -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)
Expand Down

0 comments on commit a6670c7

Please sign in to comment.