mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-29 10:55:05 +00:00
added case - generated resource is not deleted after the source is deleted
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
This commit is contained in:
parent
e768b8ae94
commit
6894f1d85c
1 changed files with 25 additions and 0 deletions
|
@ -1194,6 +1194,31 @@ func Test_Generate_Policy_Deletion_for_Clone(t *testing.T) {
|
|||
Expect(element["initial_lives"]).To(Equal("2"))
|
||||
// ============================================
|
||||
|
||||
// test: the generated resource is not deleted after the source is deleted
|
||||
//=========== Delete the Clone Source Resource ============
|
||||
By(fmt.Sprintf("Delete the clone source resource: %s", tests.ConfigMapName))
|
||||
|
||||
err = e2eClient.DeleteNamespacedResource(cmGVR, tests.CloneNamespace, tests.ConfigMapName)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
// Wait till policy is deleted
|
||||
e2e.GetWithRetry(time.Duration(2), 10, func() error {
|
||||
_, err := e2eClient.GetNamespacedResource(cmGVR, tests.CloneNamespace, tests.ConfigMapName)
|
||||
if err != nil {
|
||||
return errors.New("configmap still exists")
|
||||
}
|
||||
return nil
|
||||
})
|
||||
_, err = e2eClient.GetNamespacedResource(cmGVR, tests.CloneNamespace, tests.ConfigMapName)
|
||||
Expect(err).To(HaveOccurred())
|
||||
// ===========================================
|
||||
|
||||
// ======= Check Generated Resources =======
|
||||
By(fmt.Sprintf("Checking the generated resource (Configmap) in namespace : %s", tests.ResourceNamespace))
|
||||
_, err = e2eClient.GetNamespacedResource(cmGVR, tests.ResourceNamespace, tests.ConfigMapName)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
// ===========================================
|
||||
|
||||
// ======= CleanUp Resources =====
|
||||
e2eClient.CleanClusterPolicies(clPolGVR)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue