-
Notifications
You must be signed in to change notification settings - Fork 27
Conversation
/test e2e |
5e4219f
to
b365878
Compare
/hold |
@munnerz PR needs rebase |
Skip not found errors in DeleteAllStatefulSets
/hold cancel |
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.
This looks like a great move, I'll be glad to write less bash!
Some things:
- This needs a rebase (the cassandra e2e tests no longer use helm)
- It'd be great if the code added from k/k (eg in test/e2e/framework) could have a note about where it was sourced from to help with maintenance in the future (I think it'd be best to try and keep them in sync rather than diverging)
@munnerz PR needs rebase |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Assign the PR to them by writing The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
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.
Thanks @munnerz
I've taken a first look through and left some comments.
- I can see that this is probably going to be more easily maintainable than the bash script.
- But I'm going to miss the clarity and debugability of the bash script.
- Also going to miss the verbose
xtrace
output which shows exactly what kubectl command are being run so that I can dive in and run those commands myself if they fail. - I got the following error when I tried running the tests on my dind cluster:
make e2e-test REGISTRY=gcr.io/jetstack-richard IMAGE_TAGS=build > e2e.stdout 2>e2e.stderr
...
==> e2e.stdout <==
# Execute e2e tests
./e2e-tests \
-kubeconfig=$HOME/.kube/config \
-context=$HOSTNAME \
-elasticsearch-pilot-image-repo="gcr.io/jetstack-richard/navigator-pilot-elasticsearch" \
-elasticsearch-pilot-image-tag="build" \
-clean-start=true \
-report-dir=./_artifacts
==> e2e.stderr <==
I0322 09:28:18.242017 26104 e2e.go:178] Starting e2e run "5ae8c698-2db3-11e8-829e-42010a8c0002" on Ginkgo node 1
==> e2e.stdout <==
Running Suite: Navigator e2e suite
==================================
Random Seed: 1521710898 - Will randomize all specs
Will run 4 of 4 specs
Mar 22 09:28:18.242: INFO: >>> kubeConfig: /home/richard/.kube/config
Mar 22 09:28:18.243: INFO: >>> kubeContext: pet-instance-1
==> e2e.stderr <==
F0322 09:28:18.243381 26104 e2e.go:35] Error loading client: error creating client: invalid configuration: [context was not found for specified context: pet-instance-1, cluster has no server defined]
==> e2e.stdout <==
Makefile:37: recipe for target '.run_e2e' failed
==> e2e.stderr <==
make: *** [.run_e2e] Error 255
richard@pet-instance-1:~/go/src/github.com/jetstack/navigator$ cat /home/richard/.kube/config
apiVersion: v1
clusters:
- cluster:
insecure-skip-tls-verify: true
server: http://localhost:8080
name: dind
contexts:
- context:
cluster: dind
namespace: default
user: ""
name: dind
current-context: dind
kind: Config
preferences: {}
users: []
-context=$$HOSTNAME \ | ||
-elasticsearch-pilot-image-repo="${REGISTRY}/navigator-pilot-elasticsearch" \ | ||
-elasticsearch-pilot-image-tag="${BUILD_TAG}" \ | ||
-clean-start=true \ |
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.
The command line flags for -clean-start
say that it cleans out all namespaces except default and system.
So do the ginkgo tests re-install navigator?
-clean-start
If true, purge all namespaces except default and system before running tests. This serves to Cleanup test namespaces from failed/interrupted e2e runs in a long-lived cluster.
@@ -43,7 +43,7 @@ function retry() { | |||
|
|||
function kube_create_namespace_with_quota() { | |||
local namespace=$1 | |||
kubectl create namespace "${namespace}" | |||
kubectl create namespace "${namespace}" || true |
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.
Is this added to handle the case where the namespace already exists?
And in that case it sounds like a problem with the logic in the scripts.
And if the namespace already exists then the presumably the quota may also exist and needs a similar || true
@@ -0,0 +1,181 @@ | |||
package e2e |
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.
Is this copied from Kubernetes project?
Is there a copyright header missing?
And if we've modified it, is it clear what we've modified?
Perhaps add a few comments at the top of this file.
metav1.NamespaceSystem, | ||
metav1.NamespaceDefault, | ||
metav1.NamespacePublic, | ||
framework.TestContext.NavigatorNamespace, |
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.
Ah, so this answers my previous point.
Maybe add a comment and update the command line help?
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.
In the shell script we do delete namespace XXX --now
. Which speeds up the deletion somewhat. Does this framework do the same?
|
||
// Similar to SynchornizedBeforeSuite, we want to run some operations only once (such as collecting cluster logs). | ||
// Here, the order of functions is reversed; first, the function which runs everywhere, | ||
// and then the function that only runs on the first Ginkgo node. |
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.
typo SynchornizedBeforeSuite
// whole test being terminated. This allows arbitrary pieces of the overall | ||
// test to hook into SynchronizedAfterSuite(). | ||
func AddCleanupAction(fn func()) CleanupActionHandle { | ||
p := CleanupActionHandle(new(int)) |
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.
What does new(int)
do here?
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.
Creates a pointer to an int with the default value (0). It's basically ptr.Int(0)
es := &esList.Items[i] | ||
Logf("Deleting elasticsearchcluster %v", es.Name) | ||
// Use OrphanDependents=false so it's deleted synchronously. | ||
// We already made sure the Pods are gone inside Scale(). |
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 don't understand this comment. The AfterEach
blocks above seem to run DeleteAllElasticsearchClusters
before deleting statefulsets.
Do you mean that when deleting a statefulset it will first be scaled to zero to remove all the pods?
Failf("Node pool %q not found in ElasticsearchCluster %q", pool, es.Name) | ||
} | ||
By("Scaling node pool " + es.Name + "/" + pool + " in namespace " + es.Namespace) | ||
es, err = e.navClient.NavigatorV1alpha1().ElasticsearchClusters(es.Namespace).Update(es) |
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.
Is this susceptible to conflict errors? If Navigator has since updated the status of the ES cluster resource?
Does this need RetryOnConflict
handling?
"involvedObject.namespace": ns, | ||
"source": "navigator-controller", | ||
}.AsSelector().String() | ||
options := metav1.ListOptions{FieldSelector: selector} |
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.
That's cool. Can you use field selectors with the Lister API 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.
Yep I'm pretty sure the listers take the same metav1.ListOptions
struct 😄
@@ -0,0 +1,60 @@ | |||
package framework |
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'll assume that all the rest of the framework files are copied from Kubernetes. But note that not all of them have Kubernetes copyright headings.
Maybe add a oneline comment to the files that have been copied showing where from, what version (git hash) and if modified a summary of the changes.
You've got |
Sure, but I think I should be able to run |
@munnerz: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What this PR does / why we need it:
Adds a ginkgo based e2e testing framework, and updates the Elasticsearch e2e tests to be written with it.
fixes #32, fixes #156
Special notes for your reviewer:
Stacked on #241, #240 and #239
Release note: