@@ -33,15 +33,16 @@ func TestMergeConfig_NilFileConfig(t *testing.T) {
3333
3434func TestMergeConfig_FileValuesUsedWhenCLIUnchanged (t * testing.T ) {
3535 file := & fileConfig {
36- Target : strPtr ("https://file.example.com" ),
37- Requests : intPtr (200 ),
38- Concurrency : intPtr (20 ),
39- Timeout : strPtr ("30s" ),
40- Duration : strPtr ("1m" ),
41- Method : strPtr ("POST" ),
42- Body : strPtr (`{"data":"test"}` ),
43- Headers : []string {"X-From: file" },
44- Verbose : func () * bool { b := true ; return & b }(),
36+ Target : strPtr ("https://file.example.com" ),
37+ Requests : intPtr (200 ),
38+ Concurrency : intPtr (20 ),
39+ Timeout : strPtr ("30s" ),
40+ Duration : strPtr ("1m" ),
41+ Method : strPtr ("POST" ),
42+ Body : strPtr (`{"data":"test"}` ),
43+ Headers : []string {"X-From: file" },
44+ Verbose : func () * bool { b := true ; return & b }(),
45+ DisableRedirects : func () * bool { b := true ; return & b }(),
4546 }
4647
4748 cli := RunConfig {
@@ -64,6 +65,9 @@ func TestMergeConfig_FileValuesUsedWhenCLIUnchanged(t *testing.T) {
6465 if got .Verbose != true {
6566 t .Errorf ("Verbose: got %v, want true" , got .Verbose )
6667 }
68+ if got .DisableRedirects != true {
69+ t .Errorf ("DisableRedirects: got %v, want true" , got .DisableRedirects )
70+ }
6771 if got .Requests != 200 {
6872 t .Errorf ("Requests: got %d, want 200" , got .Requests )
6973 }
@@ -89,32 +93,35 @@ func TestMergeConfig_FileValuesUsedWhenCLIUnchanged(t *testing.T) {
8993
9094func TestMergeConfig_CLIOverridesFileValues (t * testing.T ) {
9195 file := & fileConfig {
92- Target : strPtr ("https://file.example.com" ),
93- Requests : intPtr (200 ),
94- Concurrency : intPtr (20 ),
95- Timeout : strPtr ("30s" ),
96- Method : strPtr ("POST" ),
97- Body : strPtr (`{"data":"file"}` ),
98- Headers : []string {"X-From: file" },
96+ Target : strPtr ("https://file.example.com" ),
97+ Requests : intPtr (200 ),
98+ Concurrency : intPtr (20 ),
99+ Timeout : strPtr ("30s" ),
100+ Method : strPtr ("POST" ),
101+ Body : strPtr (`{"data":"file"}` ),
102+ Headers : []string {"X-From: file" },
103+ DisableRedirects : func () * bool { b := true ; return & b }(),
99104 }
100105
101106 cli := RunConfig {
102- Target : "https://cli.example.com" ,
103- Requests : 500 ,
104- Concurrency : 50 ,
105- Timeout : 5 * time .Second ,
106- Method : "PUT" ,
107- Body : `{"data":"cli"}` ,
108- Headers : []string {"X-From: cli" },
107+ Target : "https://cli.example.com" ,
108+ Requests : 500 ,
109+ Concurrency : 50 ,
110+ Timeout : 5 * time .Second ,
111+ Method : "PUT" ,
112+ Body : `{"data":"cli"}` ,
113+ Headers : []string {"X-From: cli" },
114+ DisableRedirects : false ,
109115 }
110116
111117 changed := map [string ]bool {
112- "requests" : true ,
113- "concurrency" : true ,
114- "timeout" : true ,
115- "method" : true ,
116- "body" : true ,
117- "header" : true ,
118+ "requests" : true ,
119+ "concurrency" : true ,
120+ "timeout" : true ,
121+ "method" : true ,
122+ "body" : true ,
123+ "header" : true ,
124+ "disable-redirects" : true ,
118125 }
119126
120127 got , err := mergeConfig (file , cli , changed )
@@ -143,6 +150,9 @@ func TestMergeConfig_CLIOverridesFileValues(t *testing.T) {
143150 if len (got .Headers ) != 1 || got .Headers [0 ] != "X-From: cli" {
144151 t .Errorf ("Headers: got %v, want [X-From: cli] (CLI override)" , got .Headers )
145152 }
153+ if got .DisableRedirects != false {
154+ t .Errorf ("DisableRedirects: got %v, want false (CLI override)" , got .DisableRedirects )
155+ }
146156}
147157
148158func TestMergeConfig_PartialFileConfig (t * testing.T ) {
0 commit comments