You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-08-10 22:31:50 +02:00
Use existing schema URLs in tests (#6924)
The 1.2.0 schema URL isn't avaibable (anymore?). So link checks are failing. This upgrades the schema URLs to 1.21.0. See https://cloud-native.slack.com/archives/C02UN96HZH6/p1750664367346769 --------- Co-authored-by: Robert Pająk <pellared@hotmail.com>
This commit is contained in:
@@ -155,22 +155,22 @@ func TestMerge(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "Merge with first resource with schema",
|
||||
a: resource.NewWithAttributes("https://opentelemetry.io/schemas/1.4.0", kv41),
|
||||
a: resource.NewWithAttributes("https://opentelemetry.io/schemas/1.21.0", kv41),
|
||||
b: resource.NewSchemaless(kv42),
|
||||
want: []attribute.KeyValue{kv42},
|
||||
schemaURL: "https://opentelemetry.io/schemas/1.4.0",
|
||||
schemaURL: "https://opentelemetry.io/schemas/1.21.0",
|
||||
},
|
||||
{
|
||||
name: "Merge with second resource with schema",
|
||||
a: resource.NewSchemaless(kv41),
|
||||
b: resource.NewWithAttributes("https://opentelemetry.io/schemas/1.4.0", kv42),
|
||||
b: resource.NewWithAttributes("https://opentelemetry.io/schemas/1.21.0", kv42),
|
||||
want: []attribute.KeyValue{kv42},
|
||||
schemaURL: "https://opentelemetry.io/schemas/1.4.0",
|
||||
schemaURL: "https://opentelemetry.io/schemas/1.21.0",
|
||||
},
|
||||
{
|
||||
name: "Merge with different schemas",
|
||||
a: resource.NewWithAttributes("https://opentelemetry.io/schemas/1.4.0", kv41),
|
||||
b: resource.NewWithAttributes("https://opentelemetry.io/schemas/1.3.0", kv42),
|
||||
a: resource.NewWithAttributes("https://opentelemetry.io/schemas/1.21.0", kv41),
|
||||
b: resource.NewWithAttributes("https://opentelemetry.io/schemas/1.20.0", kv42),
|
||||
want: []attribute.KeyValue{kv42},
|
||||
isErr: true,
|
||||
},
|
||||
@@ -378,21 +378,25 @@ func TestNew(t *testing.T) {
|
||||
envars: "",
|
||||
options: []resource.Option{
|
||||
resource.WithAttributes(attribute.String("A", "B")),
|
||||
resource.WithSchemaURL("https://opentelemetry.io/schemas/1.0.0"),
|
||||
resource.WithSchemaURL("https://opentelemetry.io/schemas/1.21.0"),
|
||||
},
|
||||
resourceValues: map[string]string{
|
||||
"A": "B",
|
||||
},
|
||||
schemaURL: "https://opentelemetry.io/schemas/1.0.0",
|
||||
schemaURL: "https://opentelemetry.io/schemas/1.21.0",
|
||||
},
|
||||
{
|
||||
name: "With conflicting schema urls",
|
||||
envars: "",
|
||||
options: []resource.Option{
|
||||
resource.WithDetectors(
|
||||
resource.StringDetector("https://opentelemetry.io/schemas/1.0.0", semconv.HostNameKey, os.Hostname),
|
||||
resource.StringDetector(
|
||||
"https://opentelemetry.io/schemas/1.20.0",
|
||||
semconv.HostNameKey,
|
||||
os.Hostname,
|
||||
),
|
||||
),
|
||||
resource.WithSchemaURL("https://opentelemetry.io/schemas/1.1.0"),
|
||||
resource.WithSchemaURL("https://opentelemetry.io/schemas/1.21.0"),
|
||||
},
|
||||
resourceValues: map[string]string{
|
||||
string(semconv.HostNameKey): func() (hostname string) {
|
||||
@@ -408,14 +412,18 @@ func TestNew(t *testing.T) {
|
||||
envars: "",
|
||||
options: []resource.Option{
|
||||
resource.WithDetectors(
|
||||
resource.StringDetector("https://opentelemetry.io/schemas/1.0.0", semconv.HostNameKey, os.Hostname),
|
||||
resource.StringDetector(
|
||||
"https://opentelemetry.io/schemas/1.1.0",
|
||||
"https://opentelemetry.io/schemas/1.19.0",
|
||||
semconv.HostNameKey,
|
||||
os.Hostname,
|
||||
),
|
||||
resource.StringDetector(
|
||||
"https://opentelemetry.io/schemas/1.20.0",
|
||||
semconv.HostNameKey,
|
||||
func() (string, error) { return "", errors.New("fail") },
|
||||
),
|
||||
),
|
||||
resource.WithSchemaURL("https://opentelemetry.io/schemas/1.2.0"),
|
||||
resource.WithSchemaURL("https://opentelemetry.io/schemas/1.21.0"),
|
||||
},
|
||||
resourceValues: map[string]string{
|
||||
string(semconv.HostNameKey): func() (hostname string) {
|
||||
@@ -791,7 +799,7 @@ type fakeDetector struct{}
|
||||
func (f fakeDetector) Detect(_ context.Context) (*resource.Resource, error) {
|
||||
// A bit pedantic, but resource.NewWithAttributes returns an empty Resource when
|
||||
// no attributes specified. We want to make sure that this is concurrent-safe.
|
||||
return resource.NewWithAttributes("https://opentelemetry.io/schemas/1.3.0"), nil
|
||||
return resource.NewWithAttributes("https://opentelemetry.io/schemas/1.21.0"), nil
|
||||
}
|
||||
|
||||
var _ resource.Detector = &fakeDetector{}
|
||||
|
@@ -191,7 +191,7 @@ func TestFailedProcessorShutdownInUnregister(t *testing.T) {
|
||||
|
||||
func TestSchemaURL(t *testing.T) {
|
||||
stp := NewTracerProvider()
|
||||
schemaURL := "https://opentelemetry.io/schemas/1.2.0"
|
||||
schemaURL := "https://opentelemetry.io/schemas/1.21.0"
|
||||
tracerIface := stp.Tracer("tracername", trace.WithSchemaURL(schemaURL))
|
||||
|
||||
// Verify that the SchemaURL of the constructed Tracer is correctly populated.
|
||||
|
@@ -1515,7 +1515,7 @@ func TestWithInstrumentationVersionAndSchema(t *testing.T) {
|
||||
_, span := tp.Tracer(
|
||||
"WithInstrumentationVersion",
|
||||
trace.WithInstrumentationVersion("v0.1.0"),
|
||||
trace.WithSchemaURL("https://opentelemetry.io/schemas/1.2.0"),
|
||||
trace.WithSchemaURL("https://opentelemetry.io/schemas/1.21.0"),
|
||||
).Start(ctx, "span0")
|
||||
got, err := endSpan(te, span)
|
||||
if err != nil {
|
||||
@@ -1533,7 +1533,7 @@ func TestWithInstrumentationVersionAndSchema(t *testing.T) {
|
||||
instrumentationScope: instrumentation.Scope{
|
||||
Name: "WithInstrumentationVersion",
|
||||
Version: "v0.1.0",
|
||||
SchemaURL: "https://opentelemetry.io/schemas/1.2.0",
|
||||
SchemaURL: "https://opentelemetry.io/schemas/1.21.0",
|
||||
},
|
||||
}
|
||||
if diff := cmpDiff(got, want); diff != "" {
|
||||
|
Reference in New Issue
Block a user