Skip to content

Commit

Permalink
chore: update to ftw-tests-schema v2.0.0 (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
theseion authored May 20, 2024
1 parent f64f855 commit c4f09f9
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 35 deletions.
32 changes: 18 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Go-FTW is a replacement for [FTW](https://pypi.org/project/ftw/) which had reach
Features of Go-FTW include:
- fully customizable HTTP traffic
- CI/CD friendly
- fast (at least faster than FTW was)
- fast
- syntax checking of test files

## Install
Expand Down Expand Up @@ -119,35 +119,39 @@ Usage:
Flags:
--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.
-e, --exclude string exclude tests matching this Go regular expression (e.g. to exclude all tests beginning with "91", use "^91.*").
If you want more permanent exclusion, check the 'exclude' option in the config file.
--fail-fast Fail on first failed test
-f, --file string output file path for ftw tests. Prints to standard output by default.
-h, --help help for run
-i, --include string include only tests matching this Go regexp (e.g. to include only tests beginning with "91", use "91.*").
-i, --include string include only tests matching this Go regular expression (e.g. to include only tests beginning with "91", use "^91.*"). \nIf you want more permanent inclusion, check the 'include' option in the config file."
-l, --log-file string path to log file to watch for WAF events
--max-marker-log-lines int maximum number of lines to search for a marker before aborting (default 500)
--max-marker-retries int maximum number of times the search for log markers will be repeated.
Each time an additional request is sent to the web server, eventually forcing the log to be flushed (default 20)
-o, --output string output type for ftw tests. "normal" is the default. (default "normal")
--read-timeout duration timeout for receiving responses during test execution (default 1s)
-r, --rate-limit duration Limit the request rate to the server to 1 request per specified duration. 0 is the default, and disables rate limiting.
--read-timeout duration timeout for receiving responses during test execution (default 10s)
--show-failures-only shows only the results of failed tests
-t, --time show time spent per test
--wait-delay duration Time to wait between retries for all wait operations. (default 1s)
--wait-for-connection-timeout duration Http connection timeout, The timeout includes connection time, any redirects, and reading the response body. (default 3s)
--wait-for-expect-body-json string Expect response body JSON pattern. To know more about JSON syntax see https://github.com/tidwall/gjson/blob/master/SYNTAX.md
--wait-for-expect-body-regex string Expect response body pattern. This is just a regex.
--wait-for-expect-body-xpath string Expect response body XPath pattern. Example: `"//*[@id="tux-gear"]"`
--wait-for-expect-header string Expect response header pattern. This is a regex. Example: `"Content-Type: application/json"`.
--wait-for-expect-body-json string Expect response body JSON pattern.
--wait-for-expect-body-regex string Expect response body pattern.
--wait-for-expect-body-xpath string Expect response body XPath pattern.
--wait-for-expect-header string Expect response header pattern.
--wait-for-expect-status-code int Expect response code e.g. 200, 204, ... .
--wait-for-host string Wait for host to be available before running tests.
--wait-for-insecure-skip-tls-verify Skips TLS certificate checks for the HTTPS request.
--wait-for-insecure-skip-tls-verify Skips tls certificate checks for the HTTPS request.
--wait-for-no-redirect Do not follow HTTP 3xx redirects.
--wait-for-timeout duration Sets the timeout for all wait operations, 0 is unlimited. (default 10s)
Global Flags:
--cloud cloud mode: rely only on HTTP status codes for determining test success or failure (will not process any logs)
--config string override config file (default is $PWD/.ftw.yaml)
--debug debug output
--trace trace output: really, really verbose
--cloud cloud mode: rely only on HTTP status codes for determining test success or failure (will not process any logs)
--config string specify config file (default is $PWD/.ftw.yaml)
--debug debug output
--overrides string specify file with platform specific overrides
--trace trace output: really, really verbose
```
All the wait for flags are implemented using the [wait4x](https://github.com/atkrad/wait4x#http) library.
See their examples on how to use them. In our flags we added the prefix `--wait-for` but they behave similarly.
Expand Down
2 changes: 1 addition & 1 deletion check/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package check

import (
schema "github.com/coreruleset/ftw-tests-schema/types"
schema "github.com/coreruleset/ftw-tests-schema/v2/types"

"github.com/coreruleset/go-ftw/config"
"github.com/coreruleset/go-ftw/test"
Expand Down
2 changes: 1 addition & 1 deletion check/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package check
import (
"testing"

schema "github.com/coreruleset/ftw-tests-schema/types"
schema "github.com/coreruleset/ftw-tests-schema/v2/types"
"github.com/stretchr/testify/suite"

"github.com/coreruleset/go-ftw/config"
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"os"
"strings"

schema "github.com/coreruleset/ftw-tests-schema/types/overrides"
schema "github.com/coreruleset/ftw-tests-schema/v2/types/overrides"
"github.com/knadh/koanf/parsers/yaml"
"github.com/knadh/koanf/providers/env"
"github.com/knadh/koanf/providers/file"
Expand Down
2 changes: 1 addition & 1 deletion config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"fmt"
"regexp"

schema "github.com/coreruleset/ftw-tests-schema/types/overrides"
schema "github.com/coreruleset/ftw-tests-schema/v2/types/overrides"

"github.com/coreruleset/go-ftw/ftwhttp"
)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.21

require (
github.com/Masterminds/sprig v2.22.0+incompatible
github.com/coreruleset/ftw-tests-schema v1.1.1-0.20240513043400-8a1a71caae7a
github.com/coreruleset/ftw-tests-schema/v2 v2.0.0
github.com/go-logr/zerologr v1.2.3
github.com/goccy/go-yaml v1.9.2
github.com/google/uuid v1.6.0
Expand Down
12 changes: 2 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ github.com/antchfx/htmlquery v1.3.0/go.mod h1:zKPDVTMhfOmcwxheXUsx4rKJy8KEY/PU6e
github.com/antchfx/xpath v1.2.3 h1:CCZWOzv5bAqjVv0offZ2LVgVYFbeldKQVuLNbViZdes=
github.com/antchfx/xpath v1.2.3/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/coreruleset/ftw-tests-schema v1.1.1-0.20240513043400-8a1a71caae7a h1:YbO+KcDY2UN1mQ0pZpGWpjlfAnXBu6PvrA+MangtxTE=
github.com/coreruleset/ftw-tests-schema v1.1.1-0.20240513043400-8a1a71caae7a/go.mod h1:stf2FA6YhkPEMq30FzKvs97Qn5P9F7LHqWQbNGvGhNk=
github.com/coreruleset/ftw-tests-schema/v2 v2.0.0 h1:o2h/KYp2msZoxQ/lsPAQVv8pAVdk8dfwJq9k0jxf+Es=
github.com/coreruleset/ftw-tests-schema/v2 v2.0.0/go.mod h1:YZT8V+ROY7cC3BCc17IT1VxI+tvvlUSVshq3LDZxpMU=
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand Down Expand Up @@ -111,8 +111,6 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
Expand All @@ -121,8 +119,6 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand All @@ -140,8 +136,6 @@ golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
Expand All @@ -152,8 +146,6 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
Expand Down
2 changes: 1 addition & 1 deletion runner/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"regexp"
"time"

schema "github.com/coreruleset/ftw-tests-schema/types"
schema "github.com/coreruleset/ftw-tests-schema/v2/types"
"github.com/google/uuid"
"github.com/rs/zerolog/log"
"golang.org/x/time/rate"
Expand Down
2 changes: 1 addition & 1 deletion runner/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/rs/zerolog/log"
"github.com/stretchr/testify/suite"

"github.com/coreruleset/ftw-tests-schema/types"
"github.com/coreruleset/ftw-tests-schema/v2/types"
"github.com/coreruleset/go-ftw/check"
"github.com/coreruleset/go-ftw/config"
"github.com/coreruleset/go-ftw/ftwhttp"
Expand Down
2 changes: 1 addition & 1 deletion runner/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"encoding/json"
"time"

schema "github.com/coreruleset/ftw-tests-schema/types"
schema "github.com/coreruleset/ftw-tests-schema/v2/types"
"github.com/rs/zerolog/log"

"github.com/coreruleset/go-ftw/output"
Expand Down
2 changes: 1 addition & 1 deletion test/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package test
import (
"encoding/base64"

schema "github.com/coreruleset/ftw-tests-schema/types"
schema "github.com/coreruleset/ftw-tests-schema/v2/types"

"github.com/coreruleset/go-ftw/ftwhttp"
"github.com/coreruleset/go-ftw/utils"
Expand Down
4 changes: 2 additions & 2 deletions test/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

"slices"

schema "github.com/coreruleset/ftw-tests-schema/types"
overridesSchema "github.com/coreruleset/ftw-tests-schema/types/overrides"
schema "github.com/coreruleset/ftw-tests-schema/v2/types"
overridesSchema "github.com/coreruleset/ftw-tests-schema/v2/types/overrides"
"github.com/rs/zerolog/log"

"github.com/coreruleset/go-ftw/config"
Expand Down

0 comments on commit c4f09f9

Please sign in to comment.