Skip to content

Commit

Permalink
usm: kafka: tests: Verify expected error code exists in the request s…
Browse files Browse the repository at this point in the history
…tats
  • Loading branch information
guyarb committed Aug 23, 2024
1 parent 71768e8 commit 8f0c041
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/network/usm/kafka_monitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1515,6 +1515,12 @@ func validateProduceFetchCount(t *assert.CollectT, kafkaStats map[kafka.Key]*kaf
for kafkaKey, kafkaStat := range kafkaStats {
requestStats, exists := kafkaStat.ErrorCodeToStat[errorCode]
assert.True(t, exists, "Expected error code %d not found in stats", errorCode)
// assert does not halt the execution, we need to do it manually.
// Thus, if the error code is not found, we should not continue, as we expect it to be found for all stats.
// So, we marked this iteration as failed (by calling assert.True), and we should return here.
if !exists {
return
}
hasTLSTag := requestStats.StaticTags&network.ConnTagGo != 0
if hasTLSTag != validation.tlsEnabled {
continue
Expand Down

0 comments on commit 8f0c041

Please sign in to comment.