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

Commit

Permalink
supernode/config: add UT for IsSuperCID
Browse files Browse the repository at this point in the history
supernode/config: add UT for GetSuperPID

supernode/config: add UT for IsSuperPID

Signed-off-by: Zhou Hao <[email protected]>
  • Loading branch information
Zhou Hao committed May 13, 2020
1 parent 003b73d commit 4ca7667
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions supernode/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,32 @@ func (s *SupernodeConfigTestSuite) TestGetSuperCID(c *check.C) {

c.Assert(conf.GetSuperCID("taskID"), check.DeepEquals, "CIDPrefixtaskID")
}

func (s *SupernodeConfigTestSuite) TestIsSuperCID(c *check.C) {
conf := Config{
BaseProperties: &BaseProperties{cIDPrefix: "CIDPrefix"},
}

c.Assert(conf.IsSuperCID("CIDPrefixTest"), check.DeepEquals, true)
c.Assert(conf.IsSuperCID("Test"), check.DeepEquals, false)
}

func (s *SupernodeConfigTestSuite) TestGetSuperPID(c *check.C) {
conf := Config{
BaseProperties: &BaseProperties{superNodePID: "superNodePID"},
}

c.Assert(conf.GetSuperPID(), check.DeepEquals, "superNodePID")

conf.SetSuperPID("Test")
c.Assert(conf.GetSuperPID(), check.DeepEquals, "Test")
}

func (s *SupernodeConfigTestSuite) TestIsSuperPID(c *check.C) {
conf := Config{
BaseProperties: &BaseProperties{superNodePID: "superNodePID"},
}

c.Assert(conf.IsSuperPID("superNodePID"), check.DeepEquals, true)
c.Assert(conf.IsSuperPID("Test"), check.DeepEquals, false)
}

0 comments on commit 4ca7667

Please sign in to comment.