Skip to content

Commit 351a51f

Browse files
dmathieupellared
andauthored
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 <[email protected]>
1 parent a365d85 commit 351a51f

File tree

5 files changed

+28
-20
lines changed

5 files changed

+28
-20
lines changed

bridge/opentracing/provider_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ func TestTracerProvider(t *testing.T) {
6666
return provider.Tracer(bazbar)
6767
},
6868
func() trace.Tracer {
69-
return provider.Tracer(foobar, trace.WithSchemaURL("https://opentelemetry.io/schemas/1.2.0"))
69+
return provider.Tracer(foobar, trace.WithSchemaURL("http://opentelemetry.io/schemas/1.21.0"))
7070
},
7171
func() trace.Tracer {
7272
return provider.Tracer(foobar, trace.WithInstrumentationAttributes(attribute.String("foo", "bar")))
7373
},
7474
func() trace.Tracer {
7575
return provider.Tracer(
7676
foobar,
77-
trace.WithSchemaURL("https://opentelemetry.io/schemas/1.2.0"),
77+
trace.WithSchemaURL("https://opentelemetry.io/schemas/1.21.0"),
7878
trace.WithInstrumentationAttributes(attribute.String("foo", "bar")),
7979
)
8080
},

sdk/resource/resource_test.go

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -155,22 +155,22 @@ func TestMerge(t *testing.T) {
155155
},
156156
{
157157
name: "Merge with first resource with schema",
158-
a: resource.NewWithAttributes("https://opentelemetry.io/schemas/1.4.0", kv41),
158+
a: resource.NewWithAttributes("https://opentelemetry.io/schemas/1.21.0", kv41),
159159
b: resource.NewSchemaless(kv42),
160160
want: []attribute.KeyValue{kv42},
161-
schemaURL: "https://opentelemetry.io/schemas/1.4.0",
161+
schemaURL: "https://opentelemetry.io/schemas/1.21.0",
162162
},
163163
{
164164
name: "Merge with second resource with schema",
165165
a: resource.NewSchemaless(kv41),
166-
b: resource.NewWithAttributes("https://opentelemetry.io/schemas/1.4.0", kv42),
166+
b: resource.NewWithAttributes("https://opentelemetry.io/schemas/1.21.0", kv42),
167167
want: []attribute.KeyValue{kv42},
168-
schemaURL: "https://opentelemetry.io/schemas/1.4.0",
168+
schemaURL: "https://opentelemetry.io/schemas/1.21.0",
169169
},
170170
{
171171
name: "Merge with different schemas",
172-
a: resource.NewWithAttributes("https://opentelemetry.io/schemas/1.4.0", kv41),
173-
b: resource.NewWithAttributes("https://opentelemetry.io/schemas/1.3.0", kv42),
172+
a: resource.NewWithAttributes("https://opentelemetry.io/schemas/1.21.0", kv41),
173+
b: resource.NewWithAttributes("https://opentelemetry.io/schemas/1.20.0", kv42),
174174
want: []attribute.KeyValue{kv42},
175175
isErr: true,
176176
},
@@ -378,21 +378,25 @@ func TestNew(t *testing.T) {
378378
envars: "",
379379
options: []resource.Option{
380380
resource.WithAttributes(attribute.String("A", "B")),
381-
resource.WithSchemaURL("https://opentelemetry.io/schemas/1.0.0"),
381+
resource.WithSchemaURL("https://opentelemetry.io/schemas/1.21.0"),
382382
},
383383
resourceValues: map[string]string{
384384
"A": "B",
385385
},
386-
schemaURL: "https://opentelemetry.io/schemas/1.0.0",
386+
schemaURL: "https://opentelemetry.io/schemas/1.21.0",
387387
},
388388
{
389389
name: "With conflicting schema urls",
390390
envars: "",
391391
options: []resource.Option{
392392
resource.WithDetectors(
393-
resource.StringDetector("https://opentelemetry.io/schemas/1.0.0", semconv.HostNameKey, os.Hostname),
393+
resource.StringDetector(
394+
"https://opentelemetry.io/schemas/1.20.0",
395+
semconv.HostNameKey,
396+
os.Hostname,
397+
),
394398
),
395-
resource.WithSchemaURL("https://opentelemetry.io/schemas/1.1.0"),
399+
resource.WithSchemaURL("https://opentelemetry.io/schemas/1.21.0"),
396400
},
397401
resourceValues: map[string]string{
398402
string(semconv.HostNameKey): func() (hostname string) {
@@ -408,14 +412,18 @@ func TestNew(t *testing.T) {
408412
envars: "",
409413
options: []resource.Option{
410414
resource.WithDetectors(
411-
resource.StringDetector("https://opentelemetry.io/schemas/1.0.0", semconv.HostNameKey, os.Hostname),
412415
resource.StringDetector(
413-
"https://opentelemetry.io/schemas/1.1.0",
416+
"https://opentelemetry.io/schemas/1.19.0",
417+
semconv.HostNameKey,
418+
os.Hostname,
419+
),
420+
resource.StringDetector(
421+
"https://opentelemetry.io/schemas/1.20.0",
414422
semconv.HostNameKey,
415423
func() (string, error) { return "", errors.New("fail") },
416424
),
417425
),
418-
resource.WithSchemaURL("https://opentelemetry.io/schemas/1.2.0"),
426+
resource.WithSchemaURL("https://opentelemetry.io/schemas/1.21.0"),
419427
},
420428
resourceValues: map[string]string{
421429
string(semconv.HostNameKey): func() (hostname string) {
@@ -791,7 +799,7 @@ type fakeDetector struct{}
791799
func (f fakeDetector) Detect(_ context.Context) (*resource.Resource, error) {
792800
// A bit pedantic, but resource.NewWithAttributes returns an empty Resource when
793801
// no attributes specified. We want to make sure that this is concurrent-safe.
794-
return resource.NewWithAttributes("https://opentelemetry.io/schemas/1.3.0"), nil
802+
return resource.NewWithAttributes("https://opentelemetry.io/schemas/1.21.0"), nil
795803
}
796804

797805
var _ resource.Detector = &fakeDetector{}

sdk/trace/provider_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ func TestFailedProcessorShutdownInUnregister(t *testing.T) {
191191

192192
func TestSchemaURL(t *testing.T) {
193193
stp := NewTracerProvider()
194-
schemaURL := "https://opentelemetry.io/schemas/1.2.0"
194+
schemaURL := "https://opentelemetry.io/schemas/1.21.0"
195195
tracerIface := stp.Tracer("tracername", trace.WithSchemaURL(schemaURL))
196196

197197
// Verify that the SchemaURL of the constructed Tracer is correctly populated.

sdk/trace/trace_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,7 +1515,7 @@ func TestWithInstrumentationVersionAndSchema(t *testing.T) {
15151515
_, span := tp.Tracer(
15161516
"WithInstrumentationVersion",
15171517
trace.WithInstrumentationVersion("v0.1.0"),
1518-
trace.WithSchemaURL("https://opentelemetry.io/schemas/1.2.0"),
1518+
trace.WithSchemaURL("https://opentelemetry.io/schemas/1.21.0"),
15191519
).Start(ctx, "span0")
15201520
got, err := endSpan(te, span)
15211521
if err != nil {
@@ -1533,7 +1533,7 @@ func TestWithInstrumentationVersionAndSchema(t *testing.T) {
15331533
instrumentationScope: instrumentation.Scope{
15341534
Name: "WithInstrumentationVersion",
15351535
Version: "v0.1.0",
1536-
SchemaURL: "https://opentelemetry.io/schemas/1.2.0",
1536+
SchemaURL: "https://opentelemetry.io/schemas/1.21.0",
15371537
},
15381538
}
15391539
if diff := cmpDiff(got, want); diff != "" {

trace/config_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ func TestEndSpanConfig(t *testing.T) {
212212
func TestTracerConfig(t *testing.T) {
213213
v1 := "semver:0.0.1"
214214
v2 := "semver:1.0.0"
215-
schemaURL := "https://opentelemetry.io/schemas/1.2.0"
215+
schemaURL := "https://opentelemetry.io/schemas/1.21.0"
216216
attrs := attribute.NewSet(
217217
attribute.String("user", "alice"),
218218
attribute.Bool("admin", true),

0 commit comments

Comments
 (0)