mirror of
https://github.com/hanzoai/telemetry.git
synced 2026-10-30 20:01:49 +00:00
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description This: - Renames the `benchmark` target to `timebenchmark` and passes the `MEMBENCH` env variable on the original `benchmark` target (it was duplicated) - Adds `testutil.SkipMemoryBench` to a bunch of tests that are not there for measuring time but rather for measuring allocations - Bumps number of iterations on one queue benchmark to bump total time taken by the test <!-- Issue number if applicable --> #### Link to tracking issue Fixes #14216, updates #14111
32 lines
575 B
Go
32 lines
575 B
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package internal
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"go.opentelemetry.io/collector/internal/testutil"
|
|
)
|
|
|
|
func TestAssertMutable(t *testing.T) {
|
|
assert.NotPanics(t, func() { NewState().AssertMutable() })
|
|
assert.Panics(t, func() {
|
|
state := NewState()
|
|
state.MarkReadOnly()
|
|
state.AssertMutable()
|
|
})
|
|
}
|
|
|
|
func BenchmarkAssertMutable(b *testing.B) {
|
|
testutil.SkipMemoryBench(b)
|
|
b.ReportAllocs()
|
|
|
|
mutable := NewState()
|
|
for b.Loop() {
|
|
mutable.AssertMutable()
|
|
}
|
|
}
|