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

Function TestDelete

tempodb/backend/gcs/gcs_test.go:388–456  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

386}
387
388func TestDelete(t *testing.T) {
389 tests := []struct {
390 name string
391 prefix string
392 objectName string
393 keyPath backend.KeyPath
394 httpHandler func(t *testing.T) http.HandlerFunc
395 }{
396 {
397 name: "without prefix",
398 prefix: "",
399 objectName: "object",
400 keyPath: backend.KeyPath{"test"},
401 httpHandler: func(t *testing.T) http.HandlerFunc {
402 return func(w http.ResponseWriter, r *http.Request) {
403 if r.Method == "GET" {
404 _, _ = w.Write([]byte(`
405 {
406 "location": "US",
407 "storageClass": "STANDARD"
408 }
409 `))
410 return
411 }
412 assert.Equal(t, "/b/blerg/o/test/object", r.URL.Path)
413 _, _ = w.Write([]byte(`{}`))
414 }
415 },
416 },
417 {
418 name: "with prefix",
419 prefix: "test_storage",
420 objectName: "object",
421 keyPath: backend.KeyPath{"test"},
422 httpHandler: func(t *testing.T) http.HandlerFunc {
423 return func(w http.ResponseWriter, r *http.Request) {
424 if r.Method == "GET" {
425 _, _ = w.Write([]byte(`
426 {
427 "location": "US",
428 "storageClass": "STANDARD"
429 }
430 `))
431 return
432 }
433 assert.Equal(t, "/b/blerg/o/test_storage/test/object", r.URL.Path)
434 _, _ = w.Write([]byte(`{}`))
435 }
436 },
437 },
438 }
439
440 for _, tc := range tests {
441 t.Run(tc.name, func(t *testing.T) {
442 server := testServer(t, tc.httpHandler(t))
443 _, w, _, err := New(&Config{
444 BucketName: "blerg",
445 Endpoint: server.URL,

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected