Skip to content

Commit

Permalink
updates readme/help (#74)
Browse files Browse the repository at this point in the history
Signed-off-by: Matteo Pace <[email protected]>
  • Loading branch information
M4tteoP authored Sep 17, 2022
1 parent 75c27b7 commit ed852ae
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,16 @@ Usage:
ftw run [flags]
Flags:
-d, --dir string recursively find yaml tests in this directory (default ".")
-e, --exclude string exclude tests matching this Go regexp (e.g. to exclude all tests beginning with "91", use "91.*").
If you want more permanent exclusion, check the 'testmodify' option in the config file.
-h, --help help for run
--id string (deprecated). Use --include matching your test only.
-i, --include string include only tests matching this Go regexp (e.g. to include only tests beginning with "91", use "91.*").
-q, --quiet do not show test by test, only results
-t, --time show time spent per test
--connect-timeout duration timeout for connecting to endpoints during test execution (default 3s)
-d, --dir string recursively find yaml tests in this directory (default ".")
-e, --exclude string exclude tests matching this Go regexp (e.g. to exclude all tests beginning with "91", use "91.*").
If you want more permanent exclusion, check the 'testoverride' option in the config file.
-h, --help help for run
--id string (deprecated). Use --include matching your test only.
-i, --include string include only tests matching this Go regexp (e.g. to include only tests beginning with "91", use "91.*").
-q, --quiet do not show test by test, only results
--read-timeout duration timeout for receiving responses during test execution (default 1s)
-t, --time show time spent per test
Global Flags:
--cloud cloud mode: rely only on HTTP status codes for determining test success or failure (will not process any logs)
Expand Down Expand Up @@ -174,13 +176,13 @@ Other interesting functions you can use are: `randBytes`, `htpasswd`, `encryptAE

## Overriding tests

Sometimes you have tests that work well for some platform combinations, e.g. Apache + modsecurity2, but fail for others, e.g. NGiNX + modsecurity3. Taking that into account, you can override test results using the `testoverride` config param. The test will be run, but the _result_ would be overriden, and your comment will be printed out.
Sometimes you have tests that work well for some platform combinations, e.g. Apache + modsecurity2, but fail for others, e.g. NGiNX + modsecurity3. Taking that into account, you can override test results using the `testoverride` config param. The test will be skipped, and the result forced as configured.

Tests can be altered using four lists:
- `input` allows you to override global parameters in tests. An example usage is if you want to change the `dest_addr` of all tests to point to an external IP or host
- `ignore` is for tests you want to ignore. It will still execute the test, but ignore the result. You should add a comment on why you ignore the test
- `forcepass` is for tests you want to pass unconditionally. Test will be executed, and pass even when the test fails. You should add a comment on why you force pass the test
- `forcefail` is for tests you want to fail unconditionally. Test will be executed, and fail even when the test passes. You should add a comment on why you force fail the test
- `ignore` is for tests you want to ignore. You should add a comment on why you ignore the test
- `forcepass` is for tests you want to pass unconditionally. You should add a comment on why you force to pass the test
- `forcefail` is for tests you want to fail unconditionally. You should add a comment on why you force to fail the test

Example using all the lists above:

Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func init() {
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "override config file (default is $PWD/.ftw.yaml)")
rootCmd.PersistentFlags().BoolVarP(&debug, "debug", "", false, "debug output")
rootCmd.PersistentFlags().BoolVarP(&trace, "trace", "", false, "trace output: really, really verbose")
rootCmd.PersistentFlags().BoolVarP(&cloud, "cloud", "", false, "cloud mode: rely only in http status code for determining test succes or failure (assumes no logs access)")
rootCmd.PersistentFlags().BoolVarP(&cloud, "cloud", "", false, "cloud mode: rely only on HTTP status codes for determining test success or failure (will not process any logs)")
}

func initConfig() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ var runCmd = &cobra.Command{

func init() {
rootCmd.AddCommand(runCmd)
runCmd.Flags().StringP("exclude", "e", "", "exclude tests matching this Go regexp (e.g. to exclude all tests beginning with \"91\", use \"91.*\"). \nIf you want more permanent exclusion, check the 'testmodify' option in the config file.")
runCmd.Flags().StringP("exclude", "e", "", "exclude tests matching this Go regexp (e.g. to exclude all tests beginning with \"91\", use \"91.*\"). \nIf you want more permanent exclusion, check the 'testoverride' option in the config file.")
runCmd.Flags().StringP("include", "i", "", "include only tests matching this Go regexp (e.g. to include only tests beginning with \"91\", use \"91.*\").")
runCmd.Flags().StringP("id", "", "", "(deprecated). Use --include matching your test only.")
runCmd.Flags().StringP("dir", "d", ".", "recursively find yaml tests in this directory")
Expand Down
6 changes: 3 additions & 3 deletions config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ type FTWConfiguration struct {
// FTWTestOverride holds four lists:
//
// Input allows you to override input parameters in tests. An example usage is if you want to change the `dest_addr` of all tests to point to an external IP or host.
// Ignore is for tests you want to ignore. It will still execute the test, but ignore the results. You should add a comment on why you ignore the test
// ForcePass is for tests you want to pass unconditionally. Test will be executed, and pass even when the test fails. You should add a comment on why you force pass the test
// ForceFail is for tests you want to fail unconditionally. Test will be executed, and fail even when the test passes. You should add a comment on why you force fail the test
// Ignore is for tests you want to ignore. You should add a comment on why you ignore the test
// ForcePass is for tests you want to pass unconditionally. You should add a comment on why you force to pass the test
// ForceFail is for tests you want to fail unconditionally. You should add a comment on why you force to fail the test
type FTWTestOverride struct {
Input test.Input `koanf:"input"`
Ignore map[string]string `koanf:"ignore"`
Expand Down

0 comments on commit ed852ae

Please sign in to comment.