-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Location: pkg/validator/validator.go:216-256
cleanupCollection runs twice per validation run — once as Global Setup (line 149) and once as Global Teardown (line 209). Each time, it:
- Lists all resources currently in the collection via paginated GET
- Issues a DELETE for every resource it finds
There is no tracking of which resources were created by the validator. It simply deletes everything it finds in the collection, including resources that existed before the validator ran.
The specific scenario that triggers data loss
- User has pre-existing data in their collection
- They run aep-e2e-validator against that collection
- Global Setup fires cleanupCollection → all pre-existing resources are deleted
- Tests run, creating their own resources
- Global Teardown fires cleanupCollection → test-created resources are deleted
The data loss happens at step 3 (Global Setup), before any tests even run.
The intent was probably to ensure a clean slate before/after tests so results are deterministic. But the implementation assumes it owns the entire collection, which is unsafe if the user points the validator at a collection that has existing data.
Suggested fix (for the issue description)
The validator should either:
- Track created resources and only delete those during cleanup (safest), or
- Warn users prominently in docs that cleanupCollection will delete all data in the targeted collection, or
- Require a dedicated/empty collection and fail fast if resources already exist at Global Setup time rather than silently deleting them