From 23a2c09ce3123b1570ff64248da1f98e59307628 Mon Sep 17 00:00:00 2001 From: zhangl Date: Fri, 21 Jul 2023 15:25:29 +0000 Subject: [PATCH] fix unit test Signed-off-by: zhangl --- api/path_node_policy_test.go | 4 ++-- exchangesync/node_policy_test.go | 2 +- producer/producer_protocol_handler.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/path_node_policy_test.go b/api/path_node_policy_test.go index 29f57af5b..d64433de9 100644 --- a/api/path_node_policy_test.go +++ b/api/path_node_policy_test.go @@ -169,7 +169,7 @@ func Test_UpdateNodePolicy1(t *testing.T) { t.Errorf("no node policy returned") } else if fnp, err := FindNodePolicyForOutput(db); err != nil { t.Errorf("failed to find node policy in db, error %v", err) - } else if len(fnp.Properties) != len(*propList)+NUM_BUILT_INS-3 { + } else if len(fnp.Properties) != len(*propList)+NUM_BUILT_INS-1 { t.Errorf("incorrect node policy, there should be %v property defined, found: %v", NUM_BUILT_INS, *fnp) } else if fnp.Properties[0].Name != propName { t.Errorf("expected property %v, but received %v", propName, fnp.Properties[0].Name) @@ -194,7 +194,7 @@ func Test_UpdateNodePolicy1(t *testing.T) { t.Errorf("no node policy returned") } else if fnp, err := FindNodePolicyForOutput(db); err != nil { t.Errorf("failed to find node policy in db, error %v", err) - } else if len(fnp.Properties) != len(*propList)+NUM_BUILT_INS-3 { + } else if len(fnp.Properties) != len(*propList)+NUM_BUILT_INS-1 { t.Errorf("incorrect node policy, there should be %v property defined, found: %v", NUM_BUILT_INS, *fnp) } else if fnp.Properties[0].Name != propName { t.Errorf("expected property %v, but received %v", propName, fnp.Properties[0].Name) diff --git a/exchangesync/node_policy_test.go b/exchangesync/node_policy_test.go index 97b58b501..133940584 100644 --- a/exchangesync/node_policy_test.go +++ b/exchangesync/node_policy_test.go @@ -23,7 +23,7 @@ import ( var ExchangeNodePolicy *exchange.ExchangeNodePolicy const NUM_BUILT_INS = 7 -const CLUSTER_NUM_BUILT_INS = 4 +const CLUSTER_NUM_BUILT_INS = 6 // Verify that a Node Policy Object can be created and saved the first time. func Test_UpdateNodePolicy(t *testing.T) { diff --git a/producer/producer_protocol_handler.go b/producer/producer_protocol_handler.go index 93b74ea52..7e3900343 100644 --- a/producer/producer_protocol_handler.go +++ b/producer/producer_protocol_handler.go @@ -487,7 +487,7 @@ func (w *BaseProducerProtocolHandler) MatchClusterNamespace(tcPolicy *policy.Pol } else { compResult, _, reason := compcheck.CheckClusterNamespaceCompatibility(nodeType, cutil.GetClusterNamespace(), tcPolicy.ClusterNamespace, workload.ClusterDeployment, true, nil) if compResult { - glog.V(5).Infof(BPPHlogString(w.Name(), fmt.Sprintf("cluster namespace matches. %v"))) + glog.V(5).Infof(BPPHlogString(w.Name(), fmt.Sprintf("cluster namespace matches. %v", reason))) } else { glog.Errorf(BPPHlogString(w.Name(), fmt.Sprintf("cluster namespace not match. %v", reason))) }