MCPcopy
hub / github.com/grafana/tempo / TestObjectConfigAttributes

Function TestObjectConfigAttributes

tempodb/backend/gcs/gcs_test.go:108–147  ·  tempodb/backend/gcs/gcs_test.go::TestObjectConfigAttributes
(t *testing.T)

Source from the content-addressed store, hash-verified

106}
107
108func TestObjectConfigAttributes(t *testing.T) {
109 tests := []struct {
110 name string
111 cacheControl string
112 metadata map[string]string
113 expectedObject raw.Object
114 }{
115 {
116 name: "cache controle enabled",
117 cacheControl: "no-cache",
118 expectedObject: raw.Object{Name: "test/object", Bucket: "blerg2", CacheControl: "no-cache"},
119 },
120 {
121 name: "medata set",
122 metadata: map[string]string{"one": "1"},
123 expectedObject: raw.Object{Name: "test/object", Bucket: "blerg2", Metadata: map[string]string{"one": "1"}},
124 },
125 }
126
127 for _, tc := range tests {
128 t.Run(tc.name, func(t *testing.T) {
129 rawObject := raw.Object{}
130 server := fakeServerWithObjectAttributes(t, &rawObject)
131
132 _, w, _, err := New(&Config{
133 BucketName: "blerg2",
134 Endpoint: server.URL,
135 Insecure: true,
136 ObjectCacheControl: tc.cacheControl,
137 ObjectMetadata: tc.metadata,
138 })
139 require.NoError(t, err)
140
141 ctx := context.Background()
142
143 _ = w.Write(ctx, "object", []string{"test"}, bytes.NewReader([]byte{}), 0, nil)
144 assert.Equal(t, tc.expectedObject, rawObject)
145 })
146 }
147}
148
149func TestRetry_MarkBlockCompacted(t *testing.T) {
150 var reqCounts sync.Map

Callers

nothing calls this directly

Calls 5

NewFunction · 0.70
WriteMethod · 0.65
RunMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected