Commit f3b961b
committed
test(e2e): fix flaky namespace-watch specs; guard creator-grant rollback
The "two users" namespace-watch specs flake in CI (e.g. "doesn't show users
namespaces the other has created"): the watch occasionally returns a stale
or another user's namespace instead of the one the spec just created.
Root cause: WatchNamespaces did a cluster-scoped watch with no
ResourceVersion (so the apiserver first replays all existing namespaces) and
returned the *first* event, asserting it was this spec's namespace.
Namespaces accumulate across specs in envtest (there is no namespace GC
controller), so the replay delivers a stale namespace first and the helper
returns before the freshly-created one arrives. Fix: wait for the specific
expected namespace (keyed on name, not a count), and have callers also assert
the other user's namespace is absent, so a real cross-user leak still fails.
Also add an assertion to "recovers when there are kube write failures": after
paul's failed create of chani's namespace, no
`namespace:<ns>#creator@user:paul` relationship may remain (with
`view = viewer + creator`, a dangling grant would let paul see chani's
namespace). It passes in both lock modes -- the dual-write rollback is
correct -- so it stands as a regression guard, not a bug fix.
Unrelated to the REST mapper race; this is pre-existing e2e test-harness
flakiness, exposed once the embedded-SpiceDB metrics fix let the e2e suite
run far enough to reach these specs.
Signed-off-by: Víctor Roldán Betancort <vroldanbet@authzed.com>1 parent 61a81f9 commit f3b961b
1 file changed
Lines changed: 28 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
136 | 144 | | |
137 | 145 | | |
138 | 146 | | |
139 | | - | |
| 147 | + | |
140 | 148 | | |
141 | 149 | | |
142 | 150 | | |
| |||
147 | 155 | | |
148 | 156 | | |
149 | 157 | | |
150 | | - | |
| 158 | + | |
151 | 159 | | |
152 | 160 | | |
153 | 161 | | |
| |||
618 | 626 | | |
619 | 627 | | |
620 | 628 | | |
621 | | - | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
622 | 632 | | |
623 | 633 | | |
624 | 634 | | |
625 | 635 | | |
626 | | - | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
627 | 639 | | |
628 | 640 | | |
629 | 641 | | |
| |||
666 | 678 | | |
667 | 679 | | |
668 | 680 | | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
669 | 692 | | |
670 | 693 | | |
671 | 694 | | |
| |||
0 commit comments