Skip to content
This repository has been archived by the owner on Mar 28, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1963 from hasbro17/haseeb/ra-pod-testing
Browse files Browse the repository at this point in the history
test: run e2e test pod without framework setup
  • Loading branch information
hasbro17 authored May 24, 2018
2 parents defb12a + b785b47 commit c8f63d5
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/e2e/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,21 @@ func setup() error {
Namespace: *ns,
opImage: *opImage,
}

// Skip the etcd-operator deployment setup if the operator image was not specified
if len(Global.opImage) == 0 {
return nil
}

return Global.setup()
}

func teardown() error {
// Skip the etcd-operator teardown if the operator image was not specified
if len(Global.opImage) == 0 {
return nil
}

err := Global.deleteOperatorCompletely("etcd-operator")
if err != nil {
return err
Expand Down
21 changes: 21 additions & 0 deletions test/pod/simple/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# golang:X-alpine can't be used since it does not support the race detector flag which assumes a glibc based system, whereas alpine linux uses musl libc
# https://github.com/golang/go/issues/14481
FROM golang:1.10.2 as builder

RUN wget -nv -O /bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v1.10.2/bin/linux/amd64/kubectl

RUN chmod a+x /bin/kubectl

ADD ./ /go/src/github.com/coreos/etcd-operator

WORKDIR /go/src/github.com/coreos/etcd-operator

RUN go test ./test/e2e/ -c -o /bin/etcd-operator-e2e --race

FROM busybox:1.28.3-glibc

COPY --from=builder /bin/etcd-operator-e2e /bin
COPY --from=builder /bin/kubectl /bin
COPY --from=builder /go/src/github.com/coreos/etcd-operator/test/pod/simple/run-e2e /bin/run-e2e

CMD ["/bin/run-e2e"]
9 changes: 9 additions & 0 deletions test/pod/simple/run-e2e
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

set -o errexit
set -o nounset

: ${TEST_NAMESPACE:?"Need to set TEST_NAMESPACE"}

# Run e2e tests
/bin/etcd-operator-e2e -test.timeout 30m -test.failfast -test.parallel 4 --namespace=${TEST_NAMESPACE}
15 changes: 15 additions & 0 deletions test/pod/simple/simple-pod-templ.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Pod
metadata:
name: etcd-operator-e2e-tests
spec:
restartPolicy: Never
containers:
- name: etcd-operator-e2e-tests
image: <TEST_IMAGE>
imagePullPolicy: Always
env:
- name: TEST_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace

0 comments on commit c8f63d5

Please sign in to comment.