// Test single call to syncVolume, expecting recycling to happen. // 1. Fill in the controller with initial data // 2. Call the syncVolume *once*. // 3. Compare resulting volumes with expected volumes. func TestRecycleSync(t *testing.T) { … } // Test multiple calls to syncClaim/syncVolume and periodic sync of all // volume/claims. The test follows this pattern: // 0. Load the controller with initial data. // 1. Call controllerTest.testCall() once as in TestSync() // 2. For all volumes/claims changed by previous syncVolume/syncClaim calls, // call appropriate syncVolume/syncClaim (simulating "volume/claim changed" // events). Go to 2. if these calls change anything. // 3. When all changes are processed and no new changes were made, call // syncVolume/syncClaim on all volumes/claims (simulating "periodic sync"). // 4. If some changes were done by step 3., go to 2. (simulation of // "volume/claim updated" events, eventually performing step 3. again) // 5. When 3. does not do any changes, finish the tests and compare final set // of volumes/claims with expected claims/volumes and report differences. // // Some limit of calls in enforced to prevent endless loops. func TestRecycleMultiSync(t *testing.T) { … }