Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
matsuyoshi30 committed Nov 24, 2020
1 parent af2ae17 commit a715d46
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ func TestParseFlags(t *testing.T) {
stderr: new(bytes.Buffer),
noHTTP2: false,
localAddress: "0.0.0.0",
resolvers: "",
},
wantErr: false,
},
Expand Down Expand Up @@ -301,6 +302,29 @@ func TestMakeOptions(t *testing.T) {
},
wantErr: false,
},
{
name: "use custom DNS resolvers",
cli: &cli{
method: "GET",
resolvers: "1.2.3.4,192.168.11.1:53",
},
want: &attacker.Options{
Rate: 0,
Duration: 0,
Timeout: 0,
Method: "GET",
Body: []byte{},
Header: http.Header{},
Workers: 0,
MaxWorkers: 0,
MaxBody: 0,
HTTP2: true,
KeepAlive: true,
Buckets: []time.Duration{},
Resolvers: []string{"1.2.3.4:53", "192.168.11.1:53"},
},
wantErr: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit a715d46

Please sign in to comment.