(t *testing.T)
| 49 | ) |
| 50 | |
| 51 | func TestInstanceSearch(t *testing.T) { |
| 52 | i, ls := defaultInstanceAndTmpDir(t) |
| 53 | |
| 54 | tagKey := foo |
| 55 | tagValue := bar |
| 56 | ids, _, _, _ := writeTracesForSearch(t, i, "", tagKey, tagValue, false, false) |
| 57 | |
| 58 | req := &tempopb.SearchRequest{ |
| 59 | Query: fmt.Sprintf(`{ span.%s = "%s" }`, tagKey, tagValue), |
| 60 | } |
| 61 | req.Limit = uint32(len(ids)) + 1 |
| 62 | |
| 63 | // Test after appending to WAL. writeTracesforSearch() makes sure all traces are in the wal |
| 64 | sr, err := i.Search(t.Context(), req) |
| 65 | assert.NoError(t, err) |
| 66 | assert.Len(t, sr.Traces, len(ids)) |
| 67 | checkEqual(t, ids, sr) |
| 68 | |
| 69 | // Test after cutting new headblock |
| 70 | blockID, err := i.cutBlocks(t.Context(), true) |
| 71 | require.NoError(t, err) |
| 72 | assert.NotEqual(t, blockID, uuid.Nil) |
| 73 | |
| 74 | sr, err = i.Search(t.Context(), req) |
| 75 | assert.NoError(t, err) |
| 76 | assert.Len(t, sr.Traces, len(ids)) |
| 77 | checkEqual(t, ids, sr) |
| 78 | |
| 79 | // Test after completing a block |
| 80 | _, err = i.completeBlock(t.Context(), blockID) |
| 81 | require.NoError(t, err) |
| 82 | |
| 83 | sr, err = i.Search(t.Context(), req) |
| 84 | assert.NoError(t, err) |
| 85 | assert.Len(t, sr.Traces, len(ids)) |
| 86 | checkEqual(t, ids, sr) |
| 87 | |
| 88 | err = services.StopAndAwaitTerminated(t.Context(), ls) |
| 89 | require.NoError(t, err) |
| 90 | } |
| 91 | |
| 92 | // TestInstanceSearchTraceQL is duplicate of TestInstanceSearch for now |
| 93 | func TestInstanceSearchTraceQL(t *testing.T) { |
nothing calls this directly
no test coverage detected