Files
telemetry/pdata/plog/log_record_flags_test.go
Alex BotenandGitHub 4aac78278e [chore] use license shortform (#7694)
* [chore] use license shortform

To remain consistent w/ contrib repo, see https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/22052

Signed-off-by: Alex Boten <[email protected]>

* make goporto

Signed-off-by: Alex Boten <[email protected]>

---------

Signed-off-by: Alex Boten <[email protected]>
2023-05-18 13:11:17 -07:00

31 lines
686 B
Go

// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
package plog
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestLogRecordFlags(t *testing.T) {
flags := LogRecordFlags(1)
assert.True(t, flags.IsSampled())
assert.EqualValues(t, uint32(1), flags)
flags = flags.WithIsSampled(false)
assert.False(t, flags.IsSampled())
assert.EqualValues(t, uint32(0), flags)
flags = flags.WithIsSampled(true)
assert.True(t, flags.IsSampled())
assert.EqualValues(t, uint32(1), flags)
}
func TestDefaultLogRecordFlags(t *testing.T) {
flags := DefaultLogRecordFlags
assert.False(t, flags.IsSampled())
assert.EqualValues(t, uint32(0), flags)
}