mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-01-22 03:38:42 +02:00
dfece3d2b9
* Push->basic * Repackage * Rename away from push * Make exporter optional; export from a separate goroutine * Move pull_test into controller_test * Precommit pass * New OTLP/Prom example * Precommit * Fix the example * Shorten the example * Test starting controller w/o exporter * Test export timeout * Remove ancient example & lint * go.mod revert & tidy * Comments * Tidy a diff * Tidy a diff * Move export kind selector in the new example * Split this test into its original parts * Reduce diff size * Changelog * Remove extra Add/Done pair * Remove unused stopCh param; document the Stop behavior * Typo * Use ctx * Missed v0.15 * Apply PR feedback * Precommit pass * 0.14 -> 0.15 in new file * Remove diff chunk markers * Fix OTLP example * Upstream * dashpole comments * aneurysm9 feedback * Tidy go.sum
38 lines
1.1 KiB
Go
38 lines
1.1 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 basic
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"go.opentelemetry.io/otel/label"
|
|
"go.opentelemetry.io/otel/sdk/resource"
|
|
)
|
|
|
|
func TestWithResource(t *testing.T) {
|
|
r := resource.NewWithAttributes(label.String("A", "a"))
|
|
|
|
c := &Config{}
|
|
WithResource(r).Apply(c)
|
|
assert.Equal(t, r.Equivalent(), c.Resource.Equivalent())
|
|
|
|
// Ensure overwriting works.
|
|
c = &Config{Resource: &resource.Resource{}}
|
|
WithResource(r).Apply(c)
|
|
assert.Equal(t, r.Equivalent(), c.Resource.Equivalent())
|
|
}
|