1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2024-12-14 10:13:10 +02:00
opentelemetry-go/api/trace/tracetest/mock_tracer_test.go
Andrei Ozerov e3abf31b0b
Make trace testhelpers public (#1111)
* Make trace testhelpers public

Move MockSpan and MockTracer out of internal package into the api/trace
directory.

* Do not move internal/trace/parent into testing dir

Leave internal/trace/parent/parent.go in the internal directory.

* Fix MockTracer Start method comments

Fix "TraceID".

* Run make precommit to cleanup go.mod

Cleanum go.mod and go.sum.

* Fix tracetest MockSpan structure alignment

Make MockSpan 80 bytes instead of 88 by fixing its alignment.

* Revert bridge/opentracing/internal/mock.go imports

Do not change imports lines in bridge/opentracing/internal/mock.go.
2020-09-01 08:16:05 -07:00

40 lines
1.0 KiB
Go

// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package tracetest_test
import (
"os"
"testing"
"unsafe"
"go.opentelemetry.io/otel/api/trace/tracetest"
ottest "go.opentelemetry.io/otel/internal/testing"
)
// Ensure struct alignment prior to running tests.
func TestMain(m *testing.M) {
fields := []ottest.FieldOffset{
{
Name: "MockTracer.StartSpanID",
Offset: unsafe.Offsetof(tracetest.MockTracer{}.StartSpanID),
},
}
if !ottest.Aligned8Byte(fields, os.Stderr) {
os.Exit(1)
}
os.Exit(m.Run())
}