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

Function TestDelete

tempodb/backend/azure/azure_test.go:247–310  ·  tempodb/backend/azure/azure_test.go::TestDelete
(t *testing.T)

Source from the content-addressed store, hash-verified

245}
246
247func TestDelete(t *testing.T) {
248 tests := []struct {
249 name string
250 prefix string
251 objectName string
252 keyPath backend.KeyPath
253 httpHandler func(t *testing.T) http.HandlerFunc
254 }{
255 {
256 name: "with prefix",
257 prefix: "test_prefix",
258 objectName: "object",
259 keyPath: backend.KeyPath{"test_path"},
260 httpHandler: func(t *testing.T) http.HandlerFunc {
261 return func(w http.ResponseWriter, r *http.Request) {
262 if r.Method == "GET" {
263 _, _ = w.Write([]byte(``))
264 return
265 }
266
267 assert.Equal(t, "/testing_account/blerg/test_prefix/test_path/object", r.URL.Path)
268 w.WriteHeader(http.StatusAccepted)
269 }
270 },
271 },
272 {
273 name: "without prefix",
274 prefix: "",
275 objectName: "object",
276 keyPath: backend.KeyPath{"test_path"},
277 httpHandler: func(t *testing.T) http.HandlerFunc {
278 return func(w http.ResponseWriter, r *http.Request) {
279 if r.Method == "GET" {
280 _, _ = w.Write([]byte(``))
281 return
282 }
283
284 assert.Equal(t, "/testing_account/blerg/test_path/object", r.URL.Path)
285 w.WriteHeader(http.StatusAccepted)
286 }
287 },
288 },
289 }
290
291 for _, tc := range tests {
292 t.Run(tc.name, func(t *testing.T) {
293 server := testServer(t, tc.httpHandler(t))
294 _, w, _, err := New(&Config{
295 StorageAccountName: "testing_account",
296 StorageAccountKey: flagext.SecretWithValue("YQo="),
297 MaxBuffers: 3,
298 BufferSize: 1000,
299 ContainerName: "blerg",
300 Prefix: tc.prefix,
301 Endpoint: server.URL[7:], // [7:] -> strip http://,
302 })
303 require.NoError(t, err)
304

Callers

nothing calls this directly

Calls 7

testServerFunction · 0.70
NewFunction · 0.70
WriteMethod · 0.65
DeleteMethod · 0.65
EqualMethod · 0.45
WriteHeaderMethod · 0.45
RunMethod · 0.45

Tested by

no test coverage detected