Chore: added a new test CI to run unit test and build test for Pull Requests (#2883)

This commit is contained in:
Neko Ayaka
2023-08-16 22:29:36 +08:00
committed by GitHub
parent 218c3b4e89
commit a19a9feb52
4 changed files with 69 additions and 11 deletions

View File

@ -116,16 +116,18 @@ func TestParseRule(t *testing.T) {
expectedRule: lo.Must(NewProcess("/opt/example/example", policy, false)),
},
{
tp: C.RuleConfigIPSet,
payload: "example",
target: policy,
expectedRule: lo.Must(NewIPSet("example", policy, true)),
tp: C.RuleConfigIPSet,
payload: "example",
target: policy,
// unit test runs on Linux machine and NewIPSet(...) won't be available
expectedError: errors.New("operation not permitted"),
},
{
tp: C.RuleConfigIPSet,
payload: "example",
target: policy, params: []string{noResolve},
expectedRule: lo.Must(NewIPSet("example", policy, false)),
// unit test runs on Linux machine and NewIPSet(...) won't be available
expectedError: errors.New("operation not permitted"),
},
{
tp: C.RuleConfigMatch,