Files
Dale YarboroughandGitHub 512ecc4ba7 [chore] Standardize initialism casing in test function names (#14757)
Rename test functions to follow Go conventions for initialisms:
- Http -> HTTP
- Url -> URL
- Json -> JSON

This is a non breaking change affecting only test function names, per
guidance to start with changes that won't break backwards compatibility
in exposed APIs.

Exported API changes (e.g., `SchemaUrl`, `TraceId`) may be addressed in
a follow up PR pending guidance on the deprecation approach.

#### Description

Standardize initialism casing in test, benchmark, and fuzz function
names across 8 files.

#### Link to tracking issue

Ref #14639

#### Testing

All renamed tests pass locally.

#### Documentation

N/A - internal test changes only.
2026-03-12 16:37:32 +00:00

58 lines
1.6 KiB
Go

// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
package plog // import "go.opentelemetry.io/collector/pdata/plog"
import (
"bytes"
"testing"
"github.com/stretchr/testify/require"
)
var unexpectedBytes = "expected the same bytes from unmarshaling and marshaling."
func FuzzUnmarshalJSONLogs(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
u1 := &JSONUnmarshaler{}
ld1, err := u1.UnmarshalLogs(data)
if err != nil {
return
}
m1 := &JSONMarshaler{}
b1, err := m1.MarshalLogs(ld1)
require.NoError(t, err, "failed to marshal valid struct")
u2 := &JSONUnmarshaler{}
ld2, err := u2.UnmarshalLogs(b1)
require.NoError(t, err, "failed to unmarshal valid bytes")
m2 := &JSONMarshaler{}
b2, err := m2.MarshalLogs(ld2)
require.NoError(t, err, "failed to marshal valid struct")
require.True(t, bytes.Equal(b1, b2), "%s. \nexpected %d but got %d\n", unexpectedBytes, b1, b2)
})
}
func FuzzUnmarshalPBLogs(f *testing.F) {
f.Fuzz(func(t *testing.T, data []byte) {
u1 := &ProtoUnmarshaler{}
ld1, err := u1.UnmarshalLogs(data)
if err != nil {
return
}
m1 := &ProtoMarshaler{}
b1, err := m1.MarshalLogs(ld1)
require.NoError(t, err, "failed to marshal valid struct")
u2 := &ProtoUnmarshaler{}
ld2, err := u2.UnmarshalLogs(b1)
require.NoError(t, err, "failed to unmarshal valid bytes")
m2 := &ProtoMarshaler{}
b2, err := m2.MarshalLogs(ld2)
require.NoError(t, err, "failed to marshal valid struct")
require.True(t, bytes.Equal(b1, b2), "%s. \nexpected %d but got %d\n", unexpectedBytes, b1, b2)
})
}