Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

add more cluster e2e tests #148

Merged
merged 4 commits into from
Apr 29, 2021
Merged

add more cluster e2e tests #148

merged 4 commits into from
Apr 29, 2021

Conversation

OmerKahani
Copy link
Contributor

Add two more tests:

  • Adding a secret, after adding the applicationset
  • Deleting a secret

closes #80

@jgwest
Copy link
Member

jgwest commented Mar 8, 2021

Hey @OmerKahani, I think what you are hitting is an Argo CD issue...

I have seen that if you:

  1. Create a cluster named 'cluster1'
  2. Create an application against that cluster
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: cluster1-guestbook
  namespace: argocd-e2e
spec:
  destination:
    name: cluster1
    namespace: guestbook
  project: default
  source:
    path: guestbook
    repoURL: https://github.com/argoproj/argocd-example-apps.git
    targetRevision: HEAD
  1. Delete that cluster secret

Then Argo CD seems to get stuck in a state where it keeps trying to process that Application over and over again (eg bounded only by network I/O bandwidth) in a reconciliation loop. Which means it never gets around to deleting it (and the test fails on missing deletion)

IMHO it seems like the correct behaviour is for Argo CD to allow invalid Applications (Applications that point to clusters w/o a corresponding secret) to be deleted. The deletion finalizer and/or reconciler shouldn't prevent this operation.

@OmerKahani
Copy link
Contributor Author

OmerKahani commented Mar 9, 2021

Hey @OmerKahani, I think what you are hitting is an Argo CD issue...

I have seen that if you:

1. Create a cluster named 'cluster1'

2. Create an application against that cluster
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: cluster1-guestbook
  namespace: argocd-e2e
spec:
  destination:
    name: cluster1
    namespace: guestbook
  project: default
  source:
    path: guestbook
    repoURL: https://github.com/argoproj/argocd-example-apps.git
    targetRevision: HEAD
1. Delete that cluster secret

Then Argo CD seems to get stuck in a state where it keeps trying to process that Application over and over again (eg bounded only by network I/O bandwidth) in a reconciliation loop. Which means it never gets around to deleting it (and the test fails on missing deletion)

IMHO it seems like the correct behaviour is for Argo CD to allow invalid Applications (Applications that point to clusters w/o a corresponding secret) to be deleted. The deletion finalizer and/or reconciler shouldn't prevent this operation.

You just saved me hours of debugging :)

I will split this PR with the tests that are OK, and open an issue in ArgoCD

@jgwest
Copy link
Member

jgwest commented Mar 19, 2021

I investigated the Argo CD behaviour a bit more, and opened an Argo CD bug with steps to reproduce: argoproj/argo-cd#5817

@OmerKahani
Copy link
Contributor Author

@jgwest maybe we should add a finalizer on the secret. Then the applicationset would delete the application prior to the deletion of the app.

If the applicationset created the apps because of the secret, and the secret is been deleted I think that we should also delete the apps - what do you think?

@jgwest
Copy link
Member

jgwest commented Mar 29, 2021

Sorry for the review delay, @OmerKahani, in the process of reviewing and testing your changes I discovered and investigated race conditions in the cluster creation/deletion logic of ApplicationSet/ArgoCD, and your tests were super helpful in helping test them.

These tests have helped with:

So thanks for writing these! The code looks good to go, but I would like to hold off on merging it until #176 is fixed (merging it now would destabilize the E2E tests until the race condition is fixed.)

@OmerKahani
Copy link
Contributor Author

Sorry for the review delay, @OmerKahani, in the process of reviewing and testing your changes I discovered and investigated race conditions in the cluster creation/deletion logic of ApplicationSet/ArgoCD, and your tests were super helpful in helping test them.

These tests have helped with:

* Helped test the workaround for #170 and #171

* Help find a race condition bug in the area of cluster creation/delete: #176

* Help test a new PR to fix the above test (which is still only on my local, but which I will open on GH once 0.1.0 is out)

So thanks for writing these! The code looks good to go, but I would like to hold off on merging it until #176 is fixed (merging it now would destabilize the E2E tests until the race condition is fixed.)

Thank you!

These are probably the best tests I had ever written 😆

Copy link
Member

@jgwest jgwest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned above, looks great and very helpful for finding bugs! Thanks for taking this on, and thanks for your patience in the time it took to get it merged 😄 .

@jgwest jgwest merged commit c835ee3 into argoproj:master Apr 29, 2021
@OmerKahani OmerKahani deleted the e2e_cluster branch April 29, 2021 13:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement additional Cluster generator E2E tests
2 participants