Skip to content

refactor(e2e): extract shared kat-server backends - #5987

Closed
ppeble wants to merge 1 commit into
emissary-ingress:mainfrom
ppeble:ppeble-e2e-backends
Closed

refactor(e2e): extract shared kat-server backends#5987
ppeble wants to merge 1 commit into
emissary-ingress:mainfrom
ppeble:ppeble-e2e-backends

Conversation

@ppeble

@ppeble ppeble commented Sep 9, 2026

Copy link
Copy Markdown
Member

Description

Every fixture under test/e2e/fixtures/ was carrying its own copy of the same handful of kat-server Deployment+Service shapes, which accounted for most of the duplication across the suite's manifests.yaml files.

This adds test/e2e/backends/ with one file per distinct shape and repoints fixtures at it with an extra apply step. Chainsaw resolves apply.file relative to the directory containing the chainsaw-test.yaml that references it rather than the process working directory, so a relative path can climb out of fixtures/<name>/ into backends/ and the resources still land in that test's own ephemeral namespace.

No intended change in coverage. This is groundwork: roughly 11 more fixtures are queued behind it, and without this each one would carry another ~40 lines of copied backend YAML.

Shapes added

File Name Used by
backends/http-echo.yaml http-echo http-basic, gzip-content-type, gzip-minimum, server-name
backends/target.yaml target extauth-http, ratelimit-grpc
backends/grpc-echo.yaml grpc-echo grpc-basic
backends/rls.yaml rls ratelimit-grpc

Each fixture keeps its own CRDs (Mapping, Module, AuthService, RateLimitService, and so on) in its own manifests.yaml. Only the backend Deployment+Service moves out.

What deliberately stayed inline

A shared file's Deployment and Service use a fixed metadata.name, because apply has no equivalent of a helm value to parameterize it per fixture. A fixture can therefore only pull in a shared backend if its probe either does not assert on .json.backend or asserts exactly the name the shared file uses.

Three fixtures keep their backends inline for that reason:

  • header-routing needs two distinctly-named backends of the same shape at once (hr-target1, hr-target2).
  • gzip-unsupported-content-type asserts gzip-unsup-echo, a name only it uses.
  • tcpmapping-basic asserts tcp-echo, likewise.

Extracting those would move the duplication rather than remove it.

Line counts

before after
fixtures/*/manifests.yaml 835 514
backends/ 0 164
whole test/e2e/ 2184 2089

The tree shrinks by 95 lines despite four new files and a new README section.

Testing

Ran locally against a k3d cluster, per fixture and then all together:

  • Converted: http-basic, gzip-content-type, gzip-minimum, server-name, grpc-basic, extauth-http, ratelimit-grpc. All pass.
  • Untouched controls: header-routing, tcpmapping-basic, gzip-unsupported-content-type. All pass.
  • Full sharded make e2e/run: all 10 fixtures pass together.

Checklist

  • test/e2e/README.md documents backends/, when a fixture can use it, and when it cannot
  • No change to fixture coverage or assertions

Every fixture under test/e2e/fixtures/ was carrying its own copy of the
same handful of kat-server Deployment+Service shapes, which was most of
the duplication in manifests.yaml across the suite.

Add test/e2e/backends/ with one file per distinct shape (http-echo,
target, grpc-echo, rls) and repoint fixtures at it with an extra apply
step in chainsaw-test.yaml. Chainsaw resolves apply.file relative to the
test's own directory, so a relative path can reach outside
fixtures/<name>/ into backends/ and still land in that test's ephemeral
namespace.

A shared file's Deployment/Service both use a fixed name, since apply has
no per-fixture parameter the way a helm chart would. http-basic,
gzip-content-type, gzip-minimum and server-name share http-echo because
none of their probes assert a specific backend name that would collide
with it; extauth-http and ratelimit-grpc pull in target (and
ratelimit-grpc also rls) for the one backend each duplicated verbatim,
keeping their auth/rls-specific pieces and all CRDs in their own
manifests.yaml; grpc-basic pulls in grpc-echo.

header-routing, gzip-unsupported-content-type and tcpmapping-basic keep
their backend Deployment+Service inline: each asserts a backend name
that only it uses (or, for header-routing, needs two distinctly-named
backends of the same shape at once), so extracting them would just move
the duplication rather than remove it.

Net line count under test/e2e/ drops from 2184 to 2043 despite adding
four new files, and the fixtures/*/manifests.yaml total drops from 835 to
584 lines.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Phil Peble <phil@peble.net>
@cocogitto-bot

cocogitto-bot Bot commented Sep 9, 2026

Copy link
Copy Markdown

✔️ e1eabc1 - Conventional commits check succeeded.

@ppeble

ppeble commented Sep 9, 2026

Copy link
Copy Markdown
Member Author

Closing this. Not pursuing the shared-backend refactor right now; the duplication it removes is not blocking anything. The Chainsaw behaviour it established is worth recording for anyone who picks this up later: apply.file resolves relative to the directory containing the chainsaw-test.yaml, not the process working directory, so a fixture can reach a shared file outside its own directory and the resources still land in that test's ephemeral namespace.

@ppeble ppeble closed this Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant