@@ -73,22 +73,19 @@ metafile_exists_ttl: 0s
73
73
metafile_doesnt_exist_ttl: 0s
74
74
metafile_content_ttl: 0s` , memcached .InternalEndpoint ("memcached" ))
75
75
76
- s1 := e2ethanos .NewStoreGW (
77
- e ,
78
- "1" ,
79
- client.BucketConfig {
80
- Type : client .S3 ,
81
- Config : e2ethanos .NewS3Config (bucket , m .InternalEndpoint ("http" ), m .InternalDir ()),
82
- },
76
+ s1 := e2ethanos .NewStoreGWBuilder (e , "1" ).Init (client.BucketConfig {
77
+ Type : client .S3 ,
78
+ Config : e2ethanos .NewS3Config (bucket , m .InternalEndpoint ("http" ), m .InternalDir ()),
79
+ },
83
80
memcachedConfig ,
84
81
"" ,
85
82
nil ,
86
83
relabel.Config {
87
84
Action : relabel .Drop ,
88
85
Regex : relabel .MustNewRegexp ("value2" ),
89
86
SourceLabels : model.LabelNames {"ext1" },
90
- },
91
- )
87
+ })
88
+
92
89
testutil .Ok (t , e2e .StartAndWaitReady (s1 ))
93
90
// Ensure bucket UI.
94
91
ensureGETStatusCode (t , http .StatusOK , "http://" + path .Join (s1 .Endpoint ("http" ), "loaded" ))
@@ -409,9 +406,7 @@ func TestStoreGatewayNoCacheFile(t *testing.T) {
409
406
m := e2edb .NewMinio (e , "thanos-minio" , bucket , e2edb .WithMinioTLS ())
410
407
testutil .Ok (t , e2e .StartAndWaitReady (m ))
411
408
412
- s1 := e2ethanos .NewStoreGW (
413
- e ,
414
- "1" ,
409
+ s1 := e2ethanos .NewStoreGWBuilder (e , "1" ).Init (
415
410
client.BucketConfig {
416
411
Type : client .S3 ,
417
412
Config : e2ethanos .NewS3Config (bucket , m .InternalEndpoint ("http" ), m .InternalDir ()),
@@ -641,9 +636,7 @@ config:
641
636
addresses: [%s]
642
637
blocks_iter_ttl: 0s` , memcached .InternalEndpoint ("memcached" ))
643
638
644
- s1 := e2ethanos .NewStoreGW (
645
- e ,
646
- "1" ,
639
+ s1 := e2ethanos .NewStoreGWBuilder (e , "1" ).Init (
647
640
client.BucketConfig {
648
641
Type : client .S3 ,
649
642
Config : e2ethanos .NewS3Config (bucket , m .InternalEndpoint ("http" ), m .InternalDir ()),
@@ -750,9 +743,7 @@ metafile_exists_ttl: 0s
750
743
metafile_doesnt_exist_ttl: 0s
751
744
metafile_content_ttl: 0s`
752
745
753
- store1 := e2ethanos .NewStoreGW (
754
- e ,
755
- "1" ,
746
+ store1 := e2ethanos .NewStoreGWBuilder (e , "1" ).Init (
756
747
client.BucketConfig {
757
748
Type : client .S3 ,
758
749
Config : e2ethanos .NewS3Config (bucket , m .InternalEndpoint ("http" ), m .InternalDir ()),
@@ -761,9 +752,7 @@ metafile_content_ttl: 0s`
761
752
"" ,
762
753
nil ,
763
754
)
764
- store2 := e2ethanos .NewStoreGW (
765
- e ,
766
- "2" ,
755
+ store2 := e2ethanos .NewStoreGWBuilder (e , "2" ).Init (
767
756
client.BucketConfig {
768
757
Type : client .S3 ,
769
758
Config : e2ethanos .NewS3Config (bucket , m .InternalEndpoint ("http" ), m .InternalDir ()),
@@ -772,9 +761,7 @@ metafile_content_ttl: 0s`
772
761
"" ,
773
762
nil ,
774
763
)
775
- store3 := e2ethanos .NewStoreGW (
776
- e ,
777
- "3" ,
764
+ store3 := e2ethanos .NewStoreGWBuilder (e , "3" ).Init (
778
765
client.BucketConfig {
779
766
Type : client .S3 ,
780
767
Config : e2ethanos .NewS3Config (bucket , m .InternalEndpoint ("http" ), m .InternalDir ()),
@@ -869,9 +856,7 @@ config:
869
856
m := e2edb .NewMinio (e , "thanos-minio" , bucket , e2edb .WithMinioTLS ())
870
857
testutil .Ok (t , e2e .StartAndWaitReady (m ))
871
858
872
- store1 := e2ethanos .NewStoreGW (
873
- e ,
874
- "1" ,
859
+ store1 := e2ethanos .NewStoreGWBuilder (e , "1" ).Init (
875
860
client.BucketConfig {
876
861
Type : client .S3 ,
877
862
Config : e2ethanos .NewS3Config (bucket , m .InternalEndpoint ("http" ), m .InternalDir ()),
@@ -881,9 +866,7 @@ config:
881
866
[]string {"--store.grpc.downloaded-bytes-limit=1B" },
882
867
)
883
868
884
- store2 := e2ethanos .NewStoreGW (
885
- e ,
886
- "2" ,
869
+ store2 := e2ethanos .NewStoreGWBuilder (e , "2" ).Init (
887
870
client.BucketConfig {
888
871
Type : client .S3 ,
889
872
Config : e2ethanos .NewS3Config (bucket , m .InternalEndpoint ("http" ), m .InternalDir ()),
@@ -892,9 +875,7 @@ config:
892
875
"" ,
893
876
[]string {"--store.grpc.downloaded-bytes-limit=100B" },
894
877
)
895
- store3 := e2ethanos .NewStoreGW (
896
- e ,
897
- "3" ,
878
+ store3 := e2ethanos .NewStoreGWBuilder (e , "3" ).Init (
898
879
client.BucketConfig {
899
880
Type : client .S3 ,
900
881
Config : e2ethanos .NewS3Config (bucket , m .InternalEndpoint ("http" ), m .InternalDir ()),
@@ -1037,9 +1018,7 @@ config:
1037
1018
dns_provider_update_interval: 1s
1038
1019
auto_discovery: false` , memcached .InternalEndpoint ("memcached" ))
1039
1020
1040
- s1 := e2ethanos .NewStoreGW (
1041
- e ,
1042
- "1" ,
1021
+ s1 := e2ethanos .NewStoreGWBuilder (e , "1" ).Init (
1043
1022
client.BucketConfig {
1044
1023
Type : client .S3 ,
1045
1024
Config : e2ethanos .NewS3Config (bucket , m .InternalEndpoint ("http" ), m .InternalDir ()),
@@ -1133,9 +1112,7 @@ func TestStoreGatewayLazyExpandedPostingsEnabled(t *testing.T) {
1133
1112
testutil .Ok (t , e2e .StartAndWaitReady (m ))
1134
1113
1135
1114
// Create 2 store gateways, one with lazy expanded postings enabled and another one disabled.
1136
- s1 := e2ethanos .NewStoreGW (
1137
- e ,
1138
- "1" ,
1115
+ s1 := e2ethanos .NewStoreGWBuilder (e , "1" ).Init (
1139
1116
client.BucketConfig {
1140
1117
Type : client .S3 ,
1141
1118
Config : e2ethanos .NewS3Config (bucket , m .InternalEndpoint ("http" ), m .InternalDir ()),
@@ -1144,9 +1121,7 @@ func TestStoreGatewayLazyExpandedPostingsEnabled(t *testing.T) {
1144
1121
"" ,
1145
1122
[]string {"--store.enable-lazy-expanded-postings" },
1146
1123
)
1147
- s2 := e2ethanos .NewStoreGW (
1148
- e ,
1149
- "2" ,
1124
+ s2 := e2ethanos .NewStoreGWBuilder (e , "2" ).Init (
1150
1125
client.BucketConfig {
1151
1126
Type : client .S3 ,
1152
1127
Config : e2ethanos .NewS3Config (bucket , m .InternalEndpoint ("http" ), m .InternalDir ()),
@@ -1290,9 +1265,7 @@ func TestStoreGatewayLazyExpandedPostingsPromQLSmithFuzz(t *testing.T) {
1290
1265
testutil .Ok (t , e2e .StartAndWaitReady (m ))
1291
1266
1292
1267
// Create 2 store gateways, one with lazy expanded postings enabled and another one disabled.
1293
- s1 := e2ethanos .NewStoreGW (
1294
- e ,
1295
- "1" ,
1268
+ s1 := e2ethanos .NewStoreGWBuilder (e , "1" ).Init (
1296
1269
client.BucketConfig {
1297
1270
Type : client .S3 ,
1298
1271
Config : e2ethanos .NewS3Config (bucket , m .InternalEndpoint ("http" ), m .InternalDir ()),
@@ -1301,9 +1274,7 @@ func TestStoreGatewayLazyExpandedPostingsPromQLSmithFuzz(t *testing.T) {
1301
1274
"" ,
1302
1275
[]string {"--store.enable-lazy-expanded-postings" },
1303
1276
)
1304
- s2 := e2ethanos .NewStoreGW (
1305
- e ,
1306
- "2" ,
1277
+ s2 := e2ethanos .NewStoreGWBuilder (e , "2" ).Init (
1307
1278
client.BucketConfig {
1308
1279
Type : client .S3 ,
1309
1280
Config : e2ethanos .NewS3Config (bucket , m .InternalEndpoint ("http" ), m .InternalDir ()),
@@ -1437,3 +1408,36 @@ func TestStoreGatewayLazyExpandedPostingsPromQLSmithFuzz(t *testing.T) {
1437
1408
require .Failf (t , "finished store gateway lazy expanded posting fuzzing tests" , "%d test cases failed" , failures )
1438
1409
}
1439
1410
}
1411
+
1412
+ func TestStoreGatewayUlimitNoFiles (t * testing.T ) {
1413
+ t .Parallel ()
1414
+
1415
+ e , err := e2e .NewDockerEnvironment ("store-nofiles" )
1416
+ testutil .Ok (t , err )
1417
+ t .Cleanup (e2ethanos .CleanScenario (t , e ))
1418
+
1419
+ const bucket = "store-gateway-nofiles-test"
1420
+ m := e2edb .NewMinio (e , "thanos-minio" , bucket , e2edb .WithMinioTLS ())
1421
+ testutil .Ok (t , e2e .StartAndWaitReady (m ))
1422
+
1423
+ // Set THANOS_ULIMIT_NOFILES to a very small value to trigger ulimit error.
1424
+ env := map [string ]string {
1425
+ "THANOS_ULIMIT_NOFILES" : "1" ,
1426
+ }
1427
+
1428
+ s1 := e2ethanos .NewStoreGWBuilder (e , "32" ).
1429
+ WithEnvVars (env ).
1430
+ Init (
1431
+ client.BucketConfig {
1432
+ Type : client .S3 ,
1433
+ Config : e2ethanos .NewS3Config (bucket , m .InternalEndpoint ("http" ), m .InternalDir ()),
1434
+ },
1435
+ "" ,
1436
+ "" ,
1437
+ nil ,
1438
+ )
1439
+ err = e2e .StartAndWaitReady (s1 )
1440
+ // We expect the process to fail to start due to the low ulimit.
1441
+ // error while loading shared libraries: libc.so.6: cannot open shared object file: Error 24
1442
+ testutil .NotOk (t , err )
1443
+ }
0 commit comments