From ed852ae3189939195e14c58ca4bd3178355bc0e3 Mon Sep 17 00:00:00 2001 From: Matteo Pace Date: Sat, 17 Sep 2022 14:54:18 +0200 Subject: [PATCH] updates readme/help (#74) Signed-off-by: Matteo Pace --- README.md | 26 ++++++++++++++------------ cmd/root.go | 2 +- cmd/run.go | 2 +- config/types.go | 6 +++--- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 3960d45..7ede5ab 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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: diff --git a/cmd/root.go b/cmd/root.go index ed04f85..3c1804b 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -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() { diff --git a/cmd/run.go b/cmd/run.go index edd612a..e3fb197 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -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") diff --git a/config/types.go b/config/types.go index f932e41..2a16402 100644 --- a/config/types.go +++ b/config/types.go @@ -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"`