Skip to content
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

Merged
merged 1 commit into from
May 31, 2019
Merged

Improve tests #1667

merged 1 commit into from
May 31, 2019

Conversation

alexmt
Copy link
Collaborator

@alexmt alexmt commented May 30, 2019

@codecov
Copy link

codecov bot commented May 30, 2019

Codecov Report

Merging #1667 into master will increase coverage by 0.09%.
The diff coverage is n/a.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
util/kube/ctl.go 8.28% <0%> (-0.14%) ⬇️
server/application/forwarder_overwrite.go 100% <0%> (ø) ⬆️
server/server.go 46.97% <0%> (+0.23%) ⬆️
server/application/application.go 23.46% <0%> (+0.33%) ⬆️
server/project/project.go 62.5% <0%> (+0.45%) ⬆️
server/rbacpolicy/rbacpolicy.go 79.68% <0%> (+13.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 556f12f...767590b. Read the comment docs.

@alexmt alexmt force-pushed the improve-tests branch 6 times, most recently from 0ca8c98 to 1fb4c76 Compare May 30, 2019 22:23
@alexmt alexmt changed the title [WIP]Improve tests Improve tests May 30, 2019
@alexmt alexmt requested a review from alexec May 30, 2019 22:56
}
app := &Application{}
return app, yaml.Unmarshal([]byte(output), app)
return fixture.AppClientset.ArgoprojV1alpha1().Applications(fixture.ArgoCDNamespace).Get(c.context.name, v1.GetOptions{})
Copy link
Contributor

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?

Copy link
Collaborator Author

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"))
Copy link
Contributor

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"))
Copy link
Contributor

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?

Copy link
Collaborator Author

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?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nope, not fussed.

Copy link
Contributor

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?

Copy link
Collaborator Author

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,
Copy link
Contributor

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{}))
Copy link
Contributor

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?

Copy link
Collaborator Author

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)
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

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

nice

@alexmt alexmt force-pushed the improve-tests branch 6 times, most recently from 5d65322 to 486ee93 Compare May 31, 2019 18:31
@alexmt alexmt merged commit 8a7c870 into argoproj:master May 31, 2019
@alexmt alexmt deleted the improve-tests branch July 15, 2019 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants