@@ -43,7 +43,7 @@ func TestStore_SelectSamples(t *testing.T) {
4343 ctx = user .InjectOrgID (ctx , testTenant )
4444
4545 // Setup test data
46- now := setupTestData (ctx , t , builder )
46+ now := setupTestData (ctx , t , builder , testTenant )
4747 meta := metastore .NewObjectMetastore (builder .bucket , log .NewNopLogger (), nil )
4848 store := NewStore (builder .bucket , log .NewNopLogger (), meta )
4949
@@ -206,7 +206,7 @@ func TestStore_SelectLogs(t *testing.T) {
206206 ctx = user .InjectOrgID (ctx , testTenant )
207207
208208 // Setup test data
209- now := setupTestData (ctx , t , builder )
209+ now := setupTestData (ctx , t , builder , testTenant )
210210 meta := metastore .NewObjectMetastore (builder .bucket , log .NewNopLogger (), nil )
211211 store := NewStore (builder .bucket , log .NewLogfmtLogger (os .Stdout ), meta )
212212
@@ -370,13 +370,13 @@ func TestStore_SelectLogs(t *testing.T) {
370370 }
371371}
372372
373- func setupTestData (ctx context.Context , t * testing.T , builder * testDataBuilder ) time.Time {
373+ func setupTestData (ctx context.Context , t * testing.T , builder * testDataBuilder , tenant string ) time.Time {
374374 t .Helper ()
375375 now := time .Unix (0 , int64 (time .Hour )).UTC ()
376376
377377 // Data before the query range (should not be included in results)
378378 builder .addStream (
379- " tenant" ,
379+ tenant ,
380380 `{app="foo", env="prod"}` ,
381381 logproto.Entry {Timestamp : now .Add (- 2 * time .Hour ), Line : "foo_before1" },
382382 logproto.Entry {Timestamp : now .Add (- 2 * time .Hour ).Add (30 * time .Second ), Line : "foo_before2" },
@@ -386,15 +386,15 @@ func setupTestData(ctx context.Context, t *testing.T, builder *testDataBuilder)
386386
387387 // Data within query range
388388 builder .addStream (
389- " tenant" ,
389+ tenant ,
390390 `{app="foo", env="prod"}` ,
391391 logproto.Entry {Timestamp : now , Line : "foo1" },
392392 logproto.Entry {Timestamp : now .Add (30 * time .Second ), Line : "foo2" },
393393 logproto.Entry {Timestamp : now .Add (45 * time .Second ), Line : "foo3" },
394394 logproto.Entry {Timestamp : now .Add (50 * time .Second ), Line : "foo4" },
395395 )
396396 builder .addStream (
397- " tenant" ,
397+ tenant ,
398398 `{app="foo", env="dev"}` ,
399399 logproto.Entry {Timestamp : now .Add (10 * time .Second ), Line : "foo5" },
400400 logproto.Entry {Timestamp : now .Add (20 * time .Second ), Line : "foo6" },
@@ -403,15 +403,15 @@ func setupTestData(ctx context.Context, t *testing.T, builder *testDataBuilder)
403403 builder .flush (ctx )
404404
405405 builder .addStream (
406- " tenant" ,
406+ tenant ,
407407 `{app="bar", env="prod"}` ,
408408 logproto.Entry {Timestamp : now .Add (5 * time .Second ), Line : "bar1" },
409409 logproto.Entry {Timestamp : now .Add (15 * time .Second ), Line : "bar2" },
410410 logproto.Entry {Timestamp : now .Add (25 * time .Second ), Line : "bar3" },
411411 logproto.Entry {Timestamp : now .Add (40 * time .Second ), Line : "bar4" },
412412 )
413413 builder .addStream (
414- " tenant" ,
414+ tenant ,
415415 `{app="bar", env="dev"}` ,
416416 logproto.Entry {Timestamp : now .Add (8 * time .Second ), Line : "bar5" },
417417 logproto.Entry {Timestamp : now .Add (18 * time .Second ), Line : "bar6" },
@@ -420,7 +420,7 @@ func setupTestData(ctx context.Context, t *testing.T, builder *testDataBuilder)
420420 builder .flush (ctx )
421421
422422 builder .addStream (
423- " tenant" ,
423+ tenant ,
424424 `{app="baz", env="prod", team="a"}` ,
425425 logproto.Entry {Timestamp : now .Add (12 * time .Second ), Line : "baz1" },
426426 logproto.Entry {Timestamp : now .Add (22 * time .Second ), Line : "baz2" },
@@ -431,7 +431,7 @@ func setupTestData(ctx context.Context, t *testing.T, builder *testDataBuilder)
431431
432432 // Data after the query range (should not be included in results)
433433 builder .addStream (
434- " tenant" ,
434+ tenant ,
435435 `{app="foo", env="prod"}` ,
436436 logproto.Entry {Timestamp : now .Add (2 * time .Hour ), Line : "foo_after1" },
437437 logproto.Entry {Timestamp : now .Add (2 * time .Hour ).Add (30 * time .Second ), Line : "foo_after2" },
0 commit comments