-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve tests #1667
Improve tests #1667
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1667 +/- ##
==========================================
+ Coverage 32.67% 32.77% +0.09%
==========================================
Files 71 71
Lines 11029 11321 +292
==========================================
+ Hits 3604 3710 +106
- Misses 6900 7066 +166
- Partials 525 545 +20
Continue to review full report at Codecov.
|
0ca8c98
to
1fb4c76
Compare
} | ||
app := &Application{} | ||
return app, yaml.Unmarshal([]byte(output), app) | ||
return fixture.AppClientset.ArgoprojV1alpha1().Applications(fixture.ArgoCDNamespace).Get(c.context.name, v1.GetOptions{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this looks odd, but the intent to was make sure that we prefer to invoke the CLI tool, than the API. How come you changed this bit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot to mention it in PR description. This method is executed most frequently during e2e tests execution. Looks like any process fork takes at least 100ms, so I decided to switch it to api call to save several seconds
@@ -63,10 +64,6 @@ func getKubeConfig(configPath string, overrides clientcmd.ConfigOverrides) *rest | |||
// creates e2e tests fixture: ensures that Application CRD is installed, creates temporal namespace, starts repo and api server, | |||
// configure currently available cluster. | |||
func init() { | |||
|
|||
// trouble-shooting check to see if this busted add-on is going to cause problems | |||
FailOnErr(Run("", "kubectl", "api-resources", "-o", "name")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
&v1.DeleteOptions{PropagationPolicy: &policy}, v1.ListOptions{FieldSelector: "metadata.name!=default"})) | ||
CheckError(KubeClientset.CoreV1().Secrets(ArgoCDNamespace).DeleteCollection( | ||
&v1.DeleteOptions{PropagationPolicy: &policy}, v1.ListOptions{LabelSelector: testingLabel + "=true"})) | ||
|
||
FailOnErr(Run("", "kubectl", "delete", "ns", "-l", testingLabel+"=true", "--field-selector", "status.phase=Active", "--wait=false")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to delete this line too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need to deleted temporal namespaces. There is no API to delete collection of namespaces, so I kept one kubectl delete ...
. Would you prefer to use api here for consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, not fussed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm.. How can there be no API for this, I'd assumed that kubectl just makes API calls?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right. there is API, but no API to delete collection, only one by one deletion
@@ -160,6 +150,7 @@ func EnsureCleanState() { | |||
// changing theses causes a restart | |||
AdminPasswordHash: s.AdminPasswordHash, | |||
AdminPasswordMtime: s.AdminPasswordMtime, | |||
ServerSignature: s.ServerSignature, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
} | ||
FailOnErr(Run("", "kubectl", "delete", "appprojects", "--field-selector", "metadata.name!=default")) | ||
// takes around 5s, so we don't wait | ||
CheckError(AppClientset.ArgoprojV1alpha1().Applications(ArgoCDNamespace).DeleteCollection(&v1.DeleteOptions{PropagationPolicy: &policy}, v1.ListOptions{})) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe comment with the kubectl equivilant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure. added
if name != "" { | ||
appName := strings.TrimPrefix(name, "application.argoproj.io/") | ||
// we cannot delete any app, if an op is in progress | ||
_, _ = RunCli("app", "terminate-op", appName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to maintain this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to terminate operation after fixing #1665. After application is deleted the controller is no longs stuck trying to update operation state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
# TODO - try to reduce to 20 | ||
sleep 60 | ||
curl -v --retry 5 localhost:8080 | ||
until curl -v http://localhost:8080/healthz; do sleep 3; done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
5d65322
to
486ee93
Compare
PR has following CI improvements:
kubectl
command takes at least 100ms. Tried to switch to k8s api and it saved 40 seconds: https://github.com/argoproj/argo-cd/pull/1667/files#diff-908ea2b2aac0dffff86c703e913175b4L140