Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
rayaisaiah committed Mar 6, 2025
1 parent 394dd0b commit 449c2af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
2 changes: 0 additions & 2 deletions npm/pkg/dataplane/dataplane_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ func TestNetPolInBackgroundUpdatePolicy(t *testing.T) {
}

func TestNetPolInBackgroundSkipAddAfterRemove(t *testing.T) {
// Sleep for a bit to let IncNumACLRulesBy be resolved to avoid race condition
time.Sleep(100 * time.Millisecond)
metrics.ReinitializeAll()

calls := getBootupTestCalls()
Expand Down
20 changes: 8 additions & 12 deletions npm/pkg/dataplane/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ func (c *updatePodCache) enqueue(m *PodMetadata) *updateNPMPod {
}

if !ok {
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("[DataPlane] pod key %s not found in updatePodCache. creating a new obj", m.PodKey)
klog.Infof("[DataPlane] pod key %s not found in updatePodCache. creating a new obj", m.PodKey)

pod = newUpdateNPMPod(m)
c.cache[m.PodKey] = pod
Expand All @@ -158,8 +157,7 @@ func (c *updatePodCache) enqueue(m *PodMetadata) *updateNPMPod {
// dequeue returns the first pod in the queue and removes it from the queue.
func (c *updatePodCache) dequeue() *updateNPMPod {
if c.isEmpty() {
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("[DataPlane] updatePodCache is empty. returning nil for dequeue()")
klog.Infof("[DataPlane] updatePodCache is empty. returning nil for dequeue()")
return nil
}

Expand All @@ -179,8 +177,7 @@ func (c *updatePodCache) dequeue() *updateNPMPod {
func (c *updatePodCache) requeue(pod *updateNPMPod) {
if _, ok := c.cache[pod.PodKey]; ok {
// should not happen
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// klog.Infof("[DataPlane] pod key %s already exists in updatePodCache. skipping requeue", pod.PodKey)
klog.Infof("[DataPlane] pod key %s already exists in updatePodCache. skipping requeue", pod.PodKey)
return
}

Expand Down Expand Up @@ -211,12 +208,11 @@ func (q *netPolQueue) len() int {

// enqueue adds a NetPol to the queue. If the NetPol already exists in the queue, the NetPol object is updated.
func (q *netPolQueue) enqueue(policy *policies.NPMNetworkPolicy) {
// TODO: Refactor non-error/warning klogs with Zap and set the following logs to "debug" level
// if _, ok := q.toAdd[policy.PolicyKey]; ok {
// klog.Infof("[DataPlane] policy %s exists in netPolQueue. updating", policy.PolicyKey)
// } else {
// klog.Infof("[DataPlane] enqueuing policy %s in netPolQueue", policy.PolicyKey)
// }
if _, ok := q.toAdd[policy.PolicyKey]; ok {
klog.Infof("[DataPlane] policy %s exists in netPolQueue. updating", policy.PolicyKey)
} else {
klog.Infof("[DataPlane] enqueuing policy %s in netPolQueue", policy.PolicyKey)
}
q.toAdd[policy.PolicyKey] = policy
}

Expand Down

0 comments on commit 449c2af

Please sign in to comment.