-
Notifications
You must be signed in to change notification settings - Fork 36
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
Create E2E test suite #26
Create E2E test suite #26
Conversation
see #7 |
@JamesLaverack @munnerz i've pushed a commit here which consistently uses |
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.
@adamhosier This looks really neat.
- I ran the e2e tests locally and got a failure. See below.
- I added one or two nits in the comments below.
- It might be nice to add a new Make target, either here or in a follow up branch.
- Finally, it'd be nice to add some brief documentation for this, perhaps in the CONTRIBUTING.md doc for now.
richard feature/e2e-test ~ projects improbable-eng etcd-cluster-operator go test ./internal/test/e2e --kind --repo-root=$(pwd) -v
go: downloading sigs.k8s.io/kind v0.5.1
go: downloading go.etcd.io/etcd v3.3.17+incompatible
go: extracting sigs.k8s.io/kind v0.5.1
go: downloading github.com/sirupsen/logrus v1.4.1
go: downloading sigs.k8s.io/kustomize/v3 v3.1.1-0.20190821175718-4b67a6de1296
go: extracting github.com/sirupsen/logrus v1.4.1
go: extracting sigs.k8s.io/kustomize/v3 v3.1.1-0.20190821175718-4b67a6de1296
go: downloading github.com/go-openapi/spec v0.19.2
go: downloading github.com/emicklei/go-restful v2.9.6+incompatible
go: extracting github.com/emicklei/go-restful v2.9.6+incompatible
go: extracting go.etcd.io/etcd v3.3.17+incompatible
go: extracting github.com/go-openapi/spec v0.19.2
go: downloading github.com/go-openapi/jsonreference v0.19.2
go: downloading github.com/go-openapi/jsonpointer v0.19.2
go: downloading github.com/go-openapi/swag v0.19.2
go: extracting github.com/go-openapi/jsonreference v0.19.2
go: downloading github.com/PuerkitoBio/purell v1.1.1
go: extracting github.com/go-openapi/jsonpointer v0.19.2
go: extracting github.com/go-openapi/swag v0.19.2
go: downloading github.com/mailru/easyjson v0.0.0-20190620125010-da37f6c1e481
go: extracting github.com/PuerkitoBio/purell v1.1.1
go: downloading github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578
go: extracting github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578
go: extracting github.com/mailru/easyjson v0.0.0-20190620125010-da37f6c1e481
go: downloading github.com/coreos/etcd v3.3.17+incompatible
go: extracting github.com/coreos/etcd v3.3.17+incompatible
=== RUN TestE2E_Kind
• Ensuring node image (kindest/node:v1.15.3) 🖼 ...
time="2019-10-18T11:16:08+01:00" level=info msg="Image: kindest/node:v1.15.3 present locally"
✓ Ensuring node image (kindest/node:v1.15.3) 🖼
• Preparing nodes 📦 ...
✓ Preparing nodes 📦
• Creating kubeadm config 📜 ...
✓ Creating kubeadm config 📜
• Starting control-plane 🕹️ ...
✓ Starting control-plane 🕹️
• Installing CNI 🔌 ...
✓ Installing CNI 🔌
• Installing StorageClass 💾 ...
✓ Installing StorageClass 💾
Cluster creation complete. You can now use the cluster with:
export KUBECONFIG="$(kind get kubeconfig-path --name="etcd-e2e")"
kubectl cluster-info
--- FAIL: TestE2E_Kind (319.15s)
e2e_test.go:159: Starting Kind cluster
e2e_test.go:63: Applying CRDs
kubectl.go:17: Running kubectl apply --kustomize /home/richard/projects/improbable-eng/etcd-cluster-operator/config/crd
kubectl.go:26: customresourcedefinition.apiextensions.k8s.io/etcdclusters.etcd.improbable.io created
customresourcedefinition.apiextensions.k8s.io/etcdpeers.etcd.improbable.io created
e2e_test.go:68: Building operator image
e2e_test.go:86: Loading image in to Kind cluster
e2e_test.go:95: Applying operator
kubectl.go:17: Running kubectl apply --kustomize /home/richard/projects/improbable-eng/etcd-cluster-operator/config/rbac
kubectl.go:26: role.rbac.authorization.k8s.io/leader-election-role created
clusterrole.rbac.authorization.k8s.io/manager-role created
clusterrole.rbac.authorization.k8s.io/proxy-role created
rolebinding.rbac.authorization.k8s.io/leader-election-rolebinding created
clusterrolebinding.rbac.authorization.k8s.io/manager-rolebinding created
clusterrolebinding.rbac.authorization.k8s.io/proxy-rolebinding created
service/controller-manager-metrics-service created
kubectl.go:17: Running kubectl apply --kustomize /home/richard/projects/improbable-eng/etcd-cluster-operator/config/manager
kubectl.go:26: deployment.apps/etcd-cluster-operator created
kubectl.go:17: Running kubectl patch --kustomize /home/richard/projects/improbable-eng/etcd-cluster-operator/config/manager --type json --patch [
{
"op": "replace",
"path": "/spec/template/spec/containers/0/image",
"value": "etcd-cluster-operator:test",
},
{
"op": "replace",
"path": "/spec/template/spec/containers/0/imagePullPolicy",
"value": "Never",
},
]
kubectl.go:33: deployment.apps/etcd-cluster-operator patched
kubectl.go:17: Running kubectl get deploy etcd-cluster-operator -o=jsonpath='{.status.readyReplicas}'
e2e_test.go:133: Running tests
kubectl.go:17: Running kubectl apply --filename /home/richard/projects/improbable-eng/etcd-cluster-operator/internal/test/e2e/fixtures/cluster-client-service.yaml
kubectl.go:26: service/my-cluster-external created
kubectl.go:17: Running kubectl apply --filename /home/richard/projects/improbable-eng/etcd-cluster-operator/config/samples/etcd_v1alpha1_etcdcluster.yaml
kubectl.go:26: etcdcluster.etcd.improbable.io/my-cluster created
e2e_test.go:213: Checking if ETCD is available
e2e_test.go:213: Checking if ETCD is available
e2e_test.go:213: Checking if ETCD is available
e2e_test.go:213: Checking if ETCD is available
e2e_test.go:213: Checking if ETCD is available
e2e_test.go:213: Checking if ETCD is available
e2e_test.go:213: Checking if ETCD is available
e2e_test.go:213: Checking if ETCD is available
e2e_test.go:213: Checking if ETCD is available
e2e_test.go:213: Checking if ETCD is available
e2e_test.go:213: Checking if ETCD is available
require.go:794:
Error Trace: e2e_test.go:224
e2e_test.go:134
Error: Received unexpected error:
client: etcd cluster is unavailable or misconfigured; error #0: client: endpoint http://127.0.0.1:2379 exceeded header timeout
Test: TestE2E_Kind
e2e_test.go:185: Stopping Kind cluster
=== RUN TestE2E_CurrentContext
--- SKIP: TestE2E_CurrentContext (0.00s)
e2e_test.go:139:
FAIL
FAIL github.com/improbable-eng/etcd-cluster-operator/internal/test/e2e 319.204s
FAIL
I'll spend a few minutes digging into that e2e test failure.
require.NoError(t, err) | ||
|
||
// Ensure the operator starts. | ||
err = try.Eventually(func() error { |
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.
Unrelated to this branch, but I noticed that testify has its own Eventually
, so perhaps we can use that in future:
labels: | ||
control-plane: controller-manager | ||
name: system | ||
--- |
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 see why this is a problem, but I think the kubebuilder uses this namespace intentionally with the expectation that you will add a kustomization
which adds a namespace prefix. e.g.
# Adds namespace to all resources.
namespace: e2e
# Value of this field is prepended to the
# names of all resources, e.g. a deployment named
# "wordpress" becomes "alices-wordpress".
# Note that it should also match with the prefix (text before '-') of the namespace
# field above.
namePrefix: e2e-
# Labels to add to all resources and selectors.
#commonLabels:
See:
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.
So consider just updating the kustomization.yaml
flie instead.
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 found it puzzling why the default value was not default
It's quite frustrating that the logged progress messages (via t.Log) only show up at the end of the test run. |
Ignore my comment (above) about the tests failing. I'd forgotten that this branch hasn't got a EtcdCluster controller which creates peers, so it was never going to pass. It'd be nice if this E2E would grab the logs from the operator in case of test failures, but that can be a future improvement. |
I also notice that the test leaves behind |
@wallrj thanks for the review. i've set the homedir in the kubectl helpers & that seems to avoid building the cache inside the repo. on logs, my strategy has been to include high level checkpoints in the test's logs, which will allow people to dig in to the more specific logs of the failing component. agree that streaming logs would be a nice feature |
…ler-gen-update Revert "update controller gen and kustomize versions"
this pr:
example/cluster.yaml
this pr does not:
run this yourself with