Skip to content

Commit

Permalink
Update tests to compensate for the size of the header
Browse files Browse the repository at this point in the history
  • Loading branch information
mostafa committed Sep 20, 2023
1 parent d10630b commit 35d2d66
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ func TestProduce(t *testing.T) {
metricsValues := test.getCounterMetricsValues()
assert.Equal(t, 2.0, metricsValues[test.module.metrics.WriterWrites.Name])
assert.Equal(t, 2.0, metricsValues[test.module.metrics.WriterMessages.Name])
assert.Equal(t, 64.0, metricsValues[test.module.metrics.WriterBytes.Name])
assert.Equal(t, 66.0, metricsValues[test.module.metrics.WriterBytes.Name])
assert.Equal(t, 0.0, metricsValues[test.module.metrics.WriterErrors.Name])
assert.GreaterOrEqual(t, 1.0, metricsValues[test.module.metrics.WriterWriteTime.Name])
assert.Equal(t, 0.0, metricsValues[test.module.metrics.WriterWaitTime.Name])
assert.Equal(t, 0.0, metricsValues[test.module.metrics.WriterRetries.Name])
assert.Equal(t, 1.0, metricsValues[test.module.metrics.WriterBatchSize.Name])
assert.Equal(t, 32.0, metricsValues[test.module.metrics.WriterBatchBytes.Name])
assert.Equal(t, 33.0, metricsValues[test.module.metrics.WriterBatchBytes.Name])
assert.Equal(t, 0.0, metricsValues[test.module.metrics.WriterMaxAttempts.Name])
assert.Equal(t, 0.0, metricsValues[test.module.metrics.WriterMaxBatchSize.Name])
assert.Equal(t, 0.0, metricsValues[test.module.metrics.WriterBatchTimeout.Name])
Expand Down Expand Up @@ -145,7 +145,7 @@ func TestProduceWithoutKey(t *testing.T) {
metricsValues := test.getCounterMetricsValues()
assert.Equal(t, 0.0, metricsValues[test.module.metrics.WriterErrors.Name])
// Notice the smaller size because the key is not present (64 -> 56).
assert.Equal(t, 56.0, metricsValues[test.module.metrics.WriterBytes.Name])
assert.Equal(t, 58.0, metricsValues[test.module.metrics.WriterBytes.Name])
assert.Equal(t, 2.0, metricsValues[test.module.metrics.WriterMessages.Name])
assert.Equal(t, 2.0, metricsValues[test.module.metrics.WriterWrites.Name])
}
Expand Down Expand Up @@ -237,7 +237,7 @@ func TestProduceJSON(t *testing.T) {
// Check if one message was produced.
metricsValues := test.getCounterMetricsValues()
assert.Equal(t, 0.0, metricsValues[test.module.metrics.WriterErrors.Name])
assert.Equal(t, 39, int(metricsValues[test.module.metrics.WriterBytes.Name]))
assert.Equal(t, 40, int(metricsValues[test.module.metrics.WriterBytes.Name]))
assert.Equal(t, 1.0, metricsValues[test.module.metrics.WriterMessages.Name])
assert.Equal(t, 1.0, metricsValues[test.module.metrics.WriterWrites.Name])
}
Expand Down Expand Up @@ -295,7 +295,7 @@ func TestWriterClass(t *testing.T) {
// Check if one message was produced.
metricsValues := test.getCounterMetricsValues()
assert.Equal(t, 0.0, metricsValues[test.module.metrics.WriterErrors.Name])
assert.Equal(t, 30, int(metricsValues[test.module.metrics.WriterBytes.Name]))
assert.Equal(t, 31, int(metricsValues[test.module.metrics.WriterBytes.Name]))
assert.Equal(t, 1.0, metricsValues[test.module.metrics.WriterMessages.Name])
assert.Equal(t, 1.0, metricsValues[test.module.metrics.WriterWrites.Name])
})
Expand Down

0 comments on commit 35d2d66

Please sign in to comment.