Skip to content

Commit

Permalink
Fixing test
Browse files Browse the repository at this point in the history
Signed-off-by: Amit Schendel <amitschendel@gmail.com>
  • Loading branch information
amitschendel committed Oct 29, 2024
1 parent 1607fea commit 26b3371
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/component_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ func Test_13_MergingNetworkNeighborhoodTest(t *testing.T) {
// Record initial alert count
initialAlertCount := 0
for _, alert := range initialAlerts {
if ruleName, ok := alert.Labels["rule_name"]; ok && ruleName == "Unexpected domain request" {
if ruleName, ok := alert.Labels["rule_name"]; ok && ruleName == "Unexpected domain request" && alert.Labels["container_name"] == "server" {
initialAlertCount++
}
}
Expand Down Expand Up @@ -1055,7 +1055,7 @@ func Test_13_MergingNetworkNeighborhoodTest(t *testing.T) {
// Count new alerts after merge
newAlertCount := 0
for _, alert := range mergedAlerts {
if ruleName, ok := alert.Labels["rule_name"]; ok && ruleName == "Unexpected domain request" {
if ruleName, ok := alert.Labels["rule_name"]; ok && ruleName == "Unexpected domain request" && alert.Labels["container_name"] == "server" {
newAlertCount++
}
}
Expand All @@ -1065,7 +1065,7 @@ func Test_13_MergingNetworkNeighborhoodTest(t *testing.T) {
if newAlertCount > initialAlertCount {
t.Logf("Full alert details:")
for _, alert := range mergedAlerts {
if ruleName, ok := alert.Labels["rule_name"]; ok && ruleName == "Unexpected domain request" {
if ruleName, ok := alert.Labels["rule_name"]; ok && ruleName == "Unexpected domain request" && alert.Labels["container_name"] == "server" {
t.Logf("Alert: %+v", alert)
}
}
Expand Down Expand Up @@ -1104,7 +1104,7 @@ func Test_13_MergingNetworkNeighborhoodTest(t *testing.T) {
// Count final alerts
finalAlertCount := 0
for _, alert := range finalAlerts {
if ruleName, ok := alert.Labels["rule_name"]; ok && ruleName == "Unexpected domain request" {
if ruleName, ok := alert.Labels["rule_name"]; ok && ruleName == "Unexpected domain request" && alert.Labels["container_name"] == "server" {
finalAlertCount++
}
}
Expand All @@ -1114,7 +1114,7 @@ func Test_13_MergingNetworkNeighborhoodTest(t *testing.T) {
if finalAlertCount <= initialAlertCount {
t.Logf("Full alert details:")
for _, alert := range finalAlerts {
if ruleName, ok := alert.Labels["rule_name"]; ok && ruleName == "Unexpected domain request" {
if ruleName, ok := alert.Labels["rule_name"]; ok && ruleName == "Unexpected domain request" && alert.Labels["container_name"] == "server" {
t.Logf("Alert: %+v", alert)
}
}
Expand Down

0 comments on commit 26b3371

Please sign in to comment.