mirror of
https://github.com/storytold/irsa-manager.git
synced 2026-10-16 00:13:23 +00:00
secret deletion
This commit is contained in:
@@ -38,13 +38,16 @@ var _ = Describe("IRSASetup Controller", func() {
|
||||
Context("When reconciling a resource", func() {
|
||||
const resourceName = "test-resource"
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
typeNamespacedName := types.NamespacedName{
|
||||
Name: resourceName,
|
||||
Namespace: "default", // TODO(user):Modify as needed
|
||||
Namespace: "default",
|
||||
}
|
||||
irsasetup := &irsav1alpha1.IRSASetup{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: resourceName,
|
||||
Namespace: "default",
|
||||
},
|
||||
}
|
||||
irsasetup := &irsav1alpha1.IRSASetup{}
|
||||
|
||||
BeforeEach(func() {
|
||||
By("creating the custom resource for the Kind IRSASetup")
|
||||
@@ -69,17 +72,12 @@ var _ = Describe("IRSASetup Controller", func() {
|
||||
}
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
// TODO(user): Cleanup logic after each test, like removing the resource instance.
|
||||
resource := &irsav1alpha1.IRSASetup{}
|
||||
err := k8sClient.Get(ctx, typeNamespacedName, resource)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
By("Cleanup the specific resource instance IRSASetup")
|
||||
Expect(k8sClient.Delete(ctx, resource)).To(Succeed())
|
||||
})
|
||||
It("should successfully reconcile the resource", func() {
|
||||
awsClient := newMockAwsClient()
|
||||
expected := []types.NamespacedName{
|
||||
{Name: "name", Namespace: "default"},
|
||||
}
|
||||
|
||||
By("Reconciling the created resource")
|
||||
controllerReconciler := &IRSASetupReconciler{
|
||||
Client: k8sClient,
|
||||
@@ -91,8 +89,24 @@ var _ = Describe("IRSASetup Controller", func() {
|
||||
NamespacedName: typeNamespacedName,
|
||||
})
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
// TODO(user): Add more specific assertions depending on your controller's reconciliation logic.
|
||||
// Example: If you expect a certain status condition after reconciliation, verify it here.
|
||||
_, err = controllerReconciler.Reconcile(ctx, reconcile.Request{
|
||||
NamespacedName: typeNamespacedName,
|
||||
})
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
for _, expect := range expected {
|
||||
checkExist(expect, newSecret)
|
||||
}
|
||||
By("removing the custom resource for the Kind")
|
||||
Eventually(func() error {
|
||||
return k8sClient.Delete(ctx, irsasetup)
|
||||
}, timeout).Should(Succeed())
|
||||
_, err = controllerReconciler.Reconcile(ctx, reconcile.Request{
|
||||
NamespacedName: typeNamespacedName,
|
||||
})
|
||||
Expect(err).To(Not(HaveOccurred()))
|
||||
for _, expect := range expected {
|
||||
checkNoExist(expect, newSecret)
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user