@@ -100,3 +100,54 @@ func TestFTSBWithRequests(t *testing.T) {
100
100
t .Errorf ("Expected Limit to be 50000, got %v" , parsed ["Limit" ])
101
101
}
102
102
}
103
+
104
+ func TestFTSBWithNoLimitNoDuration (t * testing.T ) {
105
+ t .Log ("Starting Redis container..." )
106
+ dockerRun := exec .Command ("docker" , "run" , "--rm" , "-d" , "-p" , "6379:6379" , "redis:8.0-M04-bookworm" )
107
+ containerIDRaw , err := dockerRun .Output ()
108
+ if err != nil {
109
+ t .Fatalf ("Failed to start Redis container: %v" , err )
110
+ }
111
+ containerID := strings .TrimSpace (string (containerIDRaw ))
112
+ t .Cleanup (func () {
113
+ t .Log ("Stopping Redis container..." )
114
+ exec .Command ("docker" , "stop" , containerID ).Run ()
115
+ })
116
+
117
+ t .Log ("Waiting for Redis to be ready..." )
118
+ time .Sleep (2 * time .Second )
119
+
120
+ t .Log ("Running ftsb_redisearch with no --requests or --duration" )
121
+ jsonPath := "../testdata/results.nolimit.json"
122
+ cmd := exec .Command ("../bin/ftsb_redisearch" ,
123
+ "--input" , "../testdata/minimal.csv" ,
124
+ "--json-out-file" , jsonPath ,
125
+ )
126
+ cmd .Env = append (os .Environ (), "REDIS_URL=redis://localhost:6379" )
127
+ output , err := cmd .CombinedOutput ()
128
+ if err != nil {
129
+ t .Fatalf ("Benchmark failed: %v\n Output: %s" , err , string (output ))
130
+ }
131
+
132
+ data , err := os .ReadFile (jsonPath )
133
+ if err != nil {
134
+ t .Fatalf ("Failed to read json output file: %v" , err )
135
+ }
136
+
137
+ var parsed struct {
138
+ Limit int `json:"Limit"`
139
+ Totals struct {
140
+ TotalOps int `json:"TotalOps"`
141
+ } `json:"Totals"`
142
+ }
143
+ if err := json .Unmarshal (data , & parsed ); err != nil {
144
+ t .Fatalf ("Failed to parse JSON output: %v" , err )
145
+ }
146
+
147
+ if parsed .Limit != 0 {
148
+ t .Errorf ("Expected Limit to be 0, got %v" , parsed .Limit )
149
+ }
150
+ if parsed .Totals .TotalOps <= 0 {
151
+ t .Errorf ("Expected Totals.TotalOps to be > 0, got %v" , parsed .Totals .TotalOps )
152
+ }
153
+ }
0 commit comments