Skip to content

Commit

Permalink
e2e tests for multiple versions of kube (#71)
Browse files Browse the repository at this point in the history
* adding e2e testing for multiple versions of kube
  • Loading branch information
Luke Reed committed Mar 6, 2020
1 parent 16452ab commit 50d8ef7
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 3 deletions.
41 changes: 38 additions & 3 deletions .circleci/config.yml
@@ -1,4 +1,12 @@
version: 2
version: 2.1

orbs:
rok8s-scripts: fairwinds/rok8s-scripts@11

executors:
golang-exec:
docker:
- image: circleci/golang:1.13-stretch

references:
install_goreleaser: &install_goreleaser
Expand All @@ -9,13 +17,25 @@ references:
echo "8dbad6683d6fc9367e637e6eed8e01a0d63c9660 goreleaser.deb" | sha1sum -c
sudo dpkg -i goreleaser.deb
rm goreleaser.deb
e2e_config: &e2e_config
command_runner_image: quay.io/reactiveops/ci-images:v11-stretch
executor: golang-exec
pre_script: e2e/pre.sh
script: e2e/test.sh
requires:
- test
filters:
branches:
only: /.*/
tags:
ignore: /.*/

jobs:
test:
working_directory: /go/src/github.com/fairwindsops/rbac-lookup

docker:
- image: circleci/golang:1.11
- image: circleci/golang:1.13
environment:
GO111MODULE: "on"
steps:
Expand All @@ -27,7 +47,7 @@ jobs:
release:
working_directory: /go/src/github.com/fairwindsops/rbac-lookup
docker:
- image: circleci/golang:1.11
- image: circleci/golang:1.13
environment:
GO111MODULE: "on"
steps:
Expand All @@ -44,6 +64,21 @@ workflows:
filters:
branches:
only: /.*/
- rok8s-scripts/kubernetes_e2e_tests:
name: e2e test kube 1.15.7
kind_node_image: >-
"kindest/node:v1.15.7@sha256:e2df133f80ef633c53c0200114fce2ed5e1f6947477dbc83261a6a921169488d"
<<: *e2e_config
- rok8s-scripts/kubernetes_e2e_tests:
name: e2e test kube 1.16.4
kind_node_image: >-
"kindest/node:v1.16.4@sha256:b91a2c2317a000f3a783489dfb755064177dbc3a0b2f4147d50f04825d016f55"
<<: *e2e_config
- rok8s-scripts/kubernetes_e2e_tests:
name: e2e test kube 1.17.0
kind_node_image: >-
"kindest/node:v1.17.0@sha256:9512edae126da271b66b990b6fff768fbb7cd786c7d39e86bdf55906352fdf62"
<<: *e2e_config
- release:
filters:
branches:
Expand Down
12 changes: 12 additions & 0 deletions e2e/deploy/clusterrolebinding.yaml
@@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: e2e-test-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: e2e-test
namespace: default
5 changes: 5 additions & 0 deletions e2e/deploy/serviceaccount.yaml
@@ -0,0 +1,5 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: e2e-test
namespace: default
9 changes: 9 additions & 0 deletions e2e/pre.sh
@@ -0,0 +1,9 @@
#!/bin/bash

set -e

go build -ldflags "-s -w" -o rbac-lookup

docker cp rbac-lookup e2e-command-runner:/rbac-lookup

docker cp e2e/deploy e2e-command-runner:/
7 changes: 7 additions & 0 deletions e2e/test.sh
@@ -0,0 +1,7 @@
#!/bin/bash

set -e

kubectl create -f deploy/

./rbac-lookup e2e-test |grep -v "No RBAC Bindings found"
4 changes: 4 additions & 0 deletions go.sum
Expand Up @@ -78,6 +78,7 @@ github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
Expand All @@ -91,6 +92,7 @@ github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXi
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d h1:7XGaL1e6bYS1yIonGp9761ExpPPV1ui0SAC59Yube9k=
github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY=
Expand Down Expand Up @@ -288,11 +290,13 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7 h1:ZUjXAXmrAyrmmCPHgCA/vChHcpsX27MZ3yBonD/z1KE=
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/grpc v1.19.0 h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.27.0 h1:rRYRFMVgRv6E0D70Skyfsr28tDXIuuPZyWGMPdMcnXg=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down

0 comments on commit 50d8ef7

Please sign in to comment.