Skip to content

Commit

Permalink
make profile-loader integration tests generic
Browse files Browse the repository at this point in the history
  • Loading branch information
tarunKoyalwar committed May 10, 2024
1 parent 4415314 commit 65f9299
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions cmd/integration-test/profile-loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ func (h *profileLoaderByRelFile) Execute(testName string) error {
if err != nil {
return errorutil.NewWithErr(err).Msgf("failed to load template with id")
}
if len(results) < 100 {
return fmt.Errorf("incorrect result: expected more results than %d, got %v", 100, len(results))
if len(results) <= 10 {
return fmt.Errorf("incorrect result: expected more results than %d, got %v", 10, len(results))
}
return nil
}
Expand All @@ -33,21 +33,22 @@ func (h *profileLoaderById) Execute(testName string) error {
if err != nil {
return errorutil.NewWithErr(err).Msgf("failed to load template with id")
}
if len(results) < 100 {
return fmt.Errorf("incorrect result: expected more results than %d, got %v", 100, len(results))
if len(results) <= 10 {
return fmt.Errorf("incorrect result: expected more results than %d, got %v", 10, len(results))
}
return nil
}

// this profile with load kevs
type customProfileLoader struct{}

func (h *customProfileLoader) Execute(filepath string) error {
results, err := testutils.RunNucleiWithArgsAndGetResults(false, "-tl", "-tp", filepath)
if err != nil {
return errorutil.NewWithErr(err).Msgf("failed to load template with id")
}
if len(results) < 267 {
return fmt.Errorf("incorrect result: expected more results than %d, got %v", 267, len(results))
if len(results) < 1 {
return fmt.Errorf("incorrect result: expected more results than %d, got %v", 1, len(results))
}
return nil
}

0 comments on commit 65f9299

Please sign in to comment.