-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* increase coverage * add testing for constants * exclude internal/raw/constants.go from sonar coverage report * try to cover all cases * sleep before running new case * modify actions * modify actions * revert * decrease floodMilliSeconds * call cancel() function manually * remove unneccassary select statement * comment out unneccassary steps * update ulimit command * decrease file limit * print limits * append sysctl * use sudo * append to another file * fix path * change command * use sh while running ulimit command * play with file limits * add another command * add another command * manual garbage collection * remove bash commands * remove manual GC * decrease flood milliseconds * decrease payloadLength * fix changes * use mutex to lock goroutine
- Loading branch information
1 parent
a0e1c08
commit 083bd65
Showing
5 changed files
with
63 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package raw | ||
|
||
import ( | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestResolveHost(t *testing.T) { | ||
cases := []struct { | ||
caseName string | ||
host string | ||
}{ | ||
{"case1", "example.com"}, | ||
{"case2", "93.184.216.34"}, | ||
} | ||
|
||
for _, tc := range cases { | ||
t.Run(tc.caseName, func(t *testing.T) { | ||
res := resolveHost(tc.host) | ||
assert.NotNil(t, res) | ||
}) | ||
} | ||
} | ||
|
||
func TestIsDNS(t *testing.T) { | ||
cases := []struct { | ||
caseName string | ||
host string | ||
expected bool | ||
}{ | ||
{"case1", "example.com", true}, | ||
{"case2", "93.184.216.34", false}, | ||
} | ||
|
||
for _, tc := range cases { | ||
t.Run(tc.caseName, func(t *testing.T) { | ||
assert.Equal(t, isDNS(tc.host), tc.expected) | ||
}) | ||
} | ||
} | ||
|
||
func TestIsIP(t *testing.T) { | ||
cases := []struct { | ||
caseName string | ||
host string | ||
expected bool | ||
}{ | ||
{"case1", "example.com", false}, | ||
{"case2", "93.184.216.34", true}, | ||
} | ||
|
||
for _, tc := range cases { | ||
t.Run(tc.caseName, func(t *testing.T) { | ||
assert.Equal(t, isIP(tc.host), tc.expected) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters