// TestStorageVersionMigration is an integration test that verifies storage version migration works. // This test asserts following scenarios: // 1. Start API server with encryption at rest and hot reload of encryption config enabled // 2. Create a secret // 3. Update encryption config file to add a new key as write key // 4. Perform Storage Version Migration for secrets // 5. Verify that the secret is migrated to use the new key // 6. Verify that the secret is updated with a new resource version // 7. Perform another Storage Version Migration for secrets // 8. Verify that the resource version of the secret is not updated. i.e. it was a no-op update func TestStorageVersionMigration(t *testing.T) { … } // TestStorageVersionMigrationWithCRD is an integration test that verifies storage version migration works with CRD. // This test asserts following scenarios: // 1. CRD is created with version v1 (serving and storage) // 2. Verify that CRs are written and stored as v1 // 3. Update CRD to introduce v2 (for serving only), and a conversion webhook is added // 4. Verify that CRs are written to v2 but are stored as v1 // 5. CRD storage version is changed from v1 to v2 // 6. Verify that CR written as either v1 or v2 version are stored as v2 // 7. Perform Storage Version Migration to migrate all v1 CRs to v2 // 8. CRD is updated to no longer serve v1 // 9. Shutdown conversion webhook // 10. Verify RV and Generations of CRs // 11. Verify the list of CRs at v2 works func TestStorageVersionMigrationWithCRD(t *testing.T) { … } // TestStorageVersionMigrationDuringChaos serves as a stress test for the SVM controller. // It creates a CRD and a reasonable number of static instances for that resource. // It also continuously creates and deletes instances of that resource. // During all of this, it attempts to perform multiple parallel migrations of the resource. // It asserts that all migrations are successful and that none of the static instances // were changed after they were initially created (as the migrations must be a no-op). func TestStorageVersionMigrationDuringChaos(t *testing.T) { … }