Skip to content

Commit

Permalink
ftw ignore first iteration, CI (envoyproxy#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
M4tteoP authored Oct 13, 2022
1 parent 12b7087 commit 2084271
Show file tree
Hide file tree
Showing 10 changed files with 372 additions and 41 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ jobs:
ENVOY_IMAGE=$image go run mage.go e2e
done
# Currently excluded, go-ftw fails to find the destination after a while. Locally works fine.
# - name: Run regression tests (ftw)
# shell: bash
# run: go run mage.go ftw

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

Expand Down
1 change: 0 additions & 1 deletion example/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ services:
- chown -R 101:101 /home/envoy/logs
volumes:
- logs:/home/envoy/logs:rw

envoy:
depends_on:
- chown
Expand Down
2 changes: 1 addition & 1 deletion ftw/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
httpbin:
image: ealen/echo-server:latest
image: kennethreitz/httpbin:latest
chown:
image: alpine:3.16
command:
Expand Down
3 changes: 2 additions & 1 deletion ftw/envoy-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ static_resources:
root_id: ""
configuration:
"@type": "type.googleapis.com/google.protobuf.StringValue"
# NB: inline rules order matter. Some ftw-config rules override the coraza-recommended default ones.
value: |
{
"rules": [
{"inline": "Include coraza.conf-recommended.conf"},
{"inline": "Include ftw-config.conf"},
{"inline": "Include coraza.conf-recommended"},
{"inline": "Include crs-setup.conf.example"},
{"inline": "Include crs/*.conf"}
]
Expand Down
394 changes: 359 additions & 35 deletions ftw/ftw.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ftw/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ echo -e "\n[Ok] Got status code $status_code, expected 200. Ready to start."

FTW_CLOUDMODE=${FTW_CLOUDMODE:-false}

go-ftw run -d coreruleset/tests/regression/tests --config ftw.yml --read-timeout=10s --cloud=$FTW_CLOUDMODE || (echo "Envoy Logs:" && cat /home/envoy/logs/envoy.log)
go-ftw run -d coreruleset/tests/regression/tests --config ftw.yml --read-timeout=10s --cloud=$FTW_CLOUDMODE || (echo "Envoy Logs:" && cat /home/envoy/logs/envoy.log; exit 1)
1 change: 0 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ func (ctx *httpContext) OnHttpResponseBody(bodySize int, endOfStream bool) types
proxywasm.LogCriticalf("failed to get response body: %v", err)
return types.ActionContinue
}

_, err = tx.ResponseBodyWriter().Write(body)
if err != nil {
proxywasm.LogCriticalf("failed to read response body: %v", err)
Expand Down
2 changes: 1 addition & 1 deletion main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ func TestParseCRS(t *testing.T) {
opt := proxytest.
NewEmulatorOption().
WithVMContext(vm).
WithPluginConfiguration([]byte(`{ "rules": [ {"inline": "Include ftw-config.conf\nInclude coraza.conf-recommended\nInclude crs-setup.conf.example\nInclude crs/*.conf"} ] }`))
WithPluginConfiguration([]byte(`{ "rules": [ {"inline": "Include ftw-config.conf\nInclude coraza.conf-recommended.conf\nInclude crs-setup.conf.example\nInclude crs/*.conf"} ] }`))

host, reset := proxytest.NewHostEmulator(opt)
defer reset()
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions rules/ftw-config.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Overrides default SecResponseBodyMimeType in order to add application/json (httpbin response Content-Type)
SecResponseBodyMimeType text/plain text/html text/xml application/json

SecAction "id:900005,\
phase:1,\
nolog,\
Expand Down

0 comments on commit 2084271

Please sign in to comment.