Files
Pablo BaeyensandGitHub c2e0973620 [chore] Skip more benchmarks when reporting to codspeed (#14220)
<!--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
2025-11-26 13:34:52 +00:00

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()
}
}