From 6d989e44962be3d523d454d8961e8b9a59091e85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Ch=C3=A1vez?= Date: Sat, 8 Jul 2023 23:01:37 +0200 Subject: [PATCH] chore: fixes e2e pkg. --- README.md | 6 +++++- http/e2e/{ => cmd/httpe2e}/main.go | 2 +- http/e2e/{pkg/runner.go => e2e.go} | 0 testing/e2e/e2e_test.go | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) rename http/e2e/{ => cmd/httpe2e}/main.go (97%) rename http/e2e/{pkg/runner.go => e2e.go} (100%) diff --git a/README.md b/README.md index 42047a289..9071d8343 100644 --- a/README.md +++ b/README.md @@ -109,15 +109,19 @@ only the phase the rule is defined for. ## E2E Testing -[`Http/e2e/`](./http/e2e) provides an utility to run e2e tests. +[`http/e2e/`](./http/e2e) provides an utility to run e2e tests. It can be used standalone against your own waf deployment: + ```shell go run github.com/corazawaf/coraza/http/e2e@main --proxy-hostport localhost:8080 --httpbin-hostport localhost:8081 ``` + or as a library by importing: + ```go "github.com/corazawaf/coraza/v3/http/e2e/pkg" ``` + As a reference for library usage, see [`testing/e2e/e2e_test.go`](.testing/e2e/e2e_test.go). Expected directives that have to be loaded and available flags can be found in [`http/e2e/main.go`](./examples/http/e2e/main.go). diff --git a/http/e2e/main.go b/http/e2e/cmd/httpe2e/main.go similarity index 97% rename from http/e2e/main.go rename to http/e2e/cmd/httpe2e/main.go index c3f84c069..7aa027291 100644 --- a/http/e2e/main.go +++ b/http/e2e/cmd/httpe2e/main.go @@ -8,7 +8,7 @@ import ( "fmt" "os" - e2e "github.com/corazawaf/coraza/v3/http/e2e/pkg" + "github.com/corazawaf/coraza/v3/http/e2e" ) // Flags: diff --git a/http/e2e/pkg/runner.go b/http/e2e/e2e.go similarity index 100% rename from http/e2e/pkg/runner.go rename to http/e2e/e2e.go diff --git a/testing/e2e/e2e_test.go b/testing/e2e/e2e_test.go index 08fbd0999..6e698cf16 100644 --- a/testing/e2e/e2e_test.go +++ b/testing/e2e/e2e_test.go @@ -15,7 +15,7 @@ import ( "github.com/corazawaf/coraza/v3" txhttp "github.com/corazawaf/coraza/v3/http" - e2e "github.com/corazawaf/coraza/v3/http/e2e/pkg" + "github.com/corazawaf/coraza/v3/http/e2e" "github.com/mccutchen/go-httpbin/v2/httpbin" )