From 4ca7667192199fab642168b756c862b307b8fb05 Mon Sep 17 00:00:00 2001 From: Zhou Hao Date: Fri, 8 May 2020 17:26:30 +0800 Subject: [PATCH] supernode/config: add UT for IsSuperCID supernode/config: add UT for GetSuperPID supernode/config: add UT for IsSuperPID Signed-off-by: Zhou Hao --- supernode/config/config_test.go | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/supernode/config/config_test.go b/supernode/config/config_test.go index b9af02d55..e58033b4d 100644 --- a/supernode/config/config_test.go +++ b/supernode/config/config_test.go @@ -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) +}