mirror of
https://github.com/juanfont/headscale.git
synced 2026-11-04 12:39:25 +09:00
servertest: fail on skip entries no lifecycle replay reads
Consumers check entries under their own capture only, so a bare or misspelled key never went stale.
This commit is contained in:
1 parent
f49add10bb
commit
7cdecd4e78
2 files changed
+21
No files matched your search
@@ -106,6 +106,13 @@ func TestRouteApprovalCompat(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestLifecycleSkipEntriesNameCaptures(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
requireSkipCaptures(t, lifecycleSkipReasons, "route-approval", "ephemeral-lifecycle")
|
||||||
|
requireSkipCaptures(t, reauthSkipReasons, append([]string{"owner-routes", "ephemeral-lifecycle"}, reauthCompatTests...)...)
|
||||||
|
}
|
||||||
|
|
||||||
// stepCheck is one rendering of a step outcome: SaaS's, and how to read
|
// stepCheck is one rendering of a step outcome: SaaS's, and how to read
|
||||||
// headscale's.
|
// headscale's.
|
||||||
type stepCheck struct {
|
type stepCheck struct {
|
||||||
|
|||||||
@@ -622,6 +622,20 @@ func readStepCapture(t *testing.T, id string) *testcapture.Capture {
|
|||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// requireSkipCaptures fails on a skip entry that is not
|
||||||
|
// <id>/<step>/.../<check> for one of ids, the captures the map's consumers
|
||||||
|
// replay. Each consumer checks only the entries under its own capture, so
|
||||||
|
// such an entry would never go stale.
|
||||||
|
func requireSkipCaptures(t *testing.T, skips map[string]string, ids ...string) {
|
||||||
|
t.Helper()
|
||||||
|
|
||||||
|
for k := range skips {
|
||||||
|
id, rest, _ := strings.Cut(k, "/")
|
||||||
|
assert.True(t, slices.Contains(ids, id) && strings.Contains(rest, "/"),
|
||||||
|
"skip entry %q names no replayed capture and step", k)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// stepReplay drives a step capture's actions against headscale: policy
|
// stepReplay drives a step capture's actions against headscale: policy
|
||||||
// pushes, key mints and revokes, joins, relogins, profile switches,
|
// pushes, key mints and revokes, joins, relogins, profile switches,
|
||||||
// restarts, kills, shutdowns, route announcements, logouts, retires and admin
|
// restarts, kills, shutdowns, route announcements, logouts, retires and admin
|
||||||
|
|||||||
Reference in new issue
Block a user