MCPcopy
hub / github.com/docker/compose / TestExtractOtelFromContext

Function TestExtractOtelFromContext

internal/tracing/tracing_test.go:35–60  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

33)
34
35func TestExtractOtelFromContext(t *testing.T) {
36 if testing.Short() {
37 t.Skip("Requires filesystem access")
38 }
39
40 dir := t.TempDir()
41
42 st := store.New(dir, testStoreCfg)
43 err := st.CreateOrUpdate(store.Metadata{
44 Name: "test",
45 Metadata: command.DockerContext{
46 Description: t.Name(),
47 AdditionalFields: map[string]any{
48 "otel": map[string]any{
49 "OTEL_EXPORTER_OTLP_ENDPOINT": "localhost:1234",
50 },
51 },
52 },
53 Endpoints: make(map[string]any),
54 })
55 assert.NilError(t, err)
56
57 cfg, err := tracing.ConfigFromDockerContext(st, "test")
58 assert.NilError(t, err)
59 assert.Equal(t, "localhost:1234", cfg.Endpoint)
60}

Callers

nothing calls this directly

Calls 3

ConfigFromDockerContextFunction · 0.92
TempDirMethod · 0.80
NameMethod · 0.45

Tested by

no test coverage detected