SIGN IN SIGN UP

test(component): add Test_34 NetworkNeighbors CIDR collapse e2e to Matthias CIDR Collapse (#861)

* test(component): add Test_34 NetworkNeighbors CIDR collapse e2e

End-to-end component test for CIDR-based collapsing of NetworkNeighbor
entries (storage-side PreSave path). Models a curl client with two external
destinations — an S3-style endpoint clustered in a single /24 and a broader
endpoint spanning a /16 — and asserts each group collapses to its covering
CIDR block. Reads the result via the dynamic client so the test compiles
against storage types lacking the plural ipAddresses field and passes only
when storage implements the collapse.

Signed-off-by: entlein <einentlein@gmail.com>

* test(component): drive Test_34 collapse via CollapseConfiguration CR + dump on failure

Storage wires SetCollapseSettings(collapseSettingsFromCRD), so with no CR
present the effective network threshold isn't the assumed 50 default and the
groups never collapsed. Apply an explicit CollapseConfiguration (default) with
networkIPGroupThreshold=5, and replace the silent Eventually with a manual poll
that logs the stored NetworkNeighborhood if collapse never appears, so a failing
run shows whether the collapse ran with unexpected CIDRs or not at all.

Signed-off-by: entlein <einentlein@gmail.com>

* test 34 adding confusion tests where multiple things collapse

Signed-off-by: entlein <einentlein@gmail.com>

* test 34 first wait for the config to be set , next step create the expected NN as a fixutre

Signed-off-by: entlein <einentlein@gmail.com>

* test 34 with external network "probe" the multiple to-be-collapsed endpoints AFTER the collapsconfig was changed

Signed-off-by: entlein <einentlein@gmail.com>

* grouping CIDRs to avoid dedup, must be built against addon storage PR

Signed-off-by: entlein <einentlein@gmail.com>

* rewrote to address review, lets retest

Signed-off-by: entlein <einentlein@gmail.com>

* ci(component): run Test_34 in the matrix, drop unused cidr-fanout fixture

Test_34_NetworkNeighborsCIDRCollapse was never added to the
component-tests matrix, so nothing ran it. The storage-side collapse it
exercises (kubescape/storage#348 + #349) shipped in storage v0.0.298,
and kubescape/helm-charts#887 bumped the chart to that tag — which
tests/scripts/storage-tag.sh reads from helm-charts main at CI time, so
the deployed storage now carries the collapse and the test can pass.

Also drops tests/resources/networkneighbors-cidr-fanout.yaml: it was
added alongside the test but is not referenced by it (the test uses the
s3-28, s3-27, scattered, cidr-spread and v6-124 fixtures).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

Docs-exempt: CI matrix entry plus removal of an unreferenced test fixture; no production code or behavioral change
Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>

---------

Signed-off-by: entlein <einentlein@gmail.com>
Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
Co-authored-by: Entlein <eineintlein@gmail.com>
Co-authored-by: Matthias Bertschy <matthias.bertschy@gmail.com>
D
Duck committed
947f3194b843387262c6b38423eb510e709f8281
Parent: 97a9f80
Committed by GitHub <noreply@github.com> on 7/28/2026, 8:02:50 AM