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

Added E2E tests framework and test cases #137

Merged
merged 1 commit into from
Mar 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 81 additions & 25 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,53 @@
version: 2.1

orbs:
aws-cli: circleci/[email protected]
k8s: circleci/[email protected]

commands:
checkout_and_cache_dependencies:
description: "checkout code and cache go dependencies"
steps:
- checkout
- restore_cache:
key: go-mod-{{ checksum "go.sum" }}
- run:
name: go mod download
command: go mod download
- save_cache:
key: go-mod-{{ checksum "go.sum" }}
Copy link
Contributor

Choose a reason for hiding this comment

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

nice work above with the go mod caching. 👍

Copy link
Contributor Author

@M00nF1sh M00nF1sh Mar 18, 2020

Choose a reason for hiding this comment

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

😄 , only problem is we don't get docker layer cache for free..

paths:
- "/go/pkg/mod/"
run_e2e_test:
description: "build and run e2e test on EKS"
parameters:
k8s_version:
type: string
steps:
- checkout_and_cache_dependencies
- setup_remote_docker
- aws-cli/setup
- run:
name: Run e2e tests
command: CLUSTER_VERSION=<< parameters.k8s_version >> ./scripts/ci_e2e_test.sh
- store_artifacts:
path: /tmp/appmesh-e2e/clusters/

jobs:
validate-yaml:
docker:
- image: circleci/golang:1.13
working_directory: ~/build
steps:
- checkout
- run:
name: Install kubectl
command: sudo curl -L https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl && sudo chmod +x /usr/local/bin/kubectl
- k8s/install-kubectl
- run:
name: Install kubeval
command: |
mkdir -p $HOME/tools && \
cd $HOME/tools && \
curl -L https://github.com/instrumenta/kubeval/releases/latest/download/kubeval-linux-amd64.tar.gz | tar xz && sudo mv kubeval /bin/kubeval
curl -L https://github.com/instrumenta/kubeval/releases/latest/download/kubeval-linux-amd64.tar.gz | tar xz && \
sudo mv kubeval /usr/local/bin/kubeval
- run:
name: Validate deploy yamls
command: |
Expand All @@ -23,44 +57,66 @@ jobs:
- image: circleci/golang:1.13
working_directory: ~/build
steps:
- checkout
- restore_cache:
keys:
- go-mod-{{ checksum "go.sum" }}
- run:
name: go mod download
command: go mod download
- checkout_and_cache_dependencies
- run:
name: Lint
command: make go-fmt
- run:
name: Build
command: make linux
- run:
name: Test
name: Unit test
command: make test
- run:
name: Verify code gen
command: make verify-codegen
- run:
name: Run
command: _output/bin/app-mesh-controller version
- save_cache:
key: go-mod-{{ checksum "go.sum" }}
paths:
- "/go/pkg/mod/"
e2e_test_114:
docker:
- image: circleci/golang:1.13
working_directory: ~/build
steps:
- run_e2e_test:
k8s_version: "1.14"
e2e_test_113:
docker:
- image: circleci/golang:1.13
working_directory: ~/build
steps:
- run_e2e_test:
k8s_version: "1.13"
e2e_test_112:
docker:
- image: circleci/golang:1.13
working_directory: ~/build
steps:
- run_e2e_test:
k8s_version: "1.12"

workflows:
version: 2
test:
check:
jobs:
- validate-yaml:
- validate-yaml
- build-test-run
- hold:
type: approval
requires:
- validate-yaml
- build-test-run
- e2e_test_114:
requires:
- hold
nightly-test-run:
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
ignore:
- gh-pages
- build-test-run:
filters:
branches:
ignore:
- gh-pages
only:
- master
jobs:
- e2e_test_114
- e2e_test_113
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ mock-gen:
./scripts/mockgen.sh

PACKAGES:=$(shell go list ./... | sed -n '1!p' | grep ${PKG}/pkg | grep -v ${PKG}/pkg/client)
.PHONY: test
test:
echo "mode: count" > coverage-all.out
$(foreach pkg,$(PACKAGES), \
Expand Down
34 changes: 22 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,34 @@ go 1.13
require (
github.com/aws/aws-sdk-go v1.29.13
github.com/deckarep/golang-set v1.7.1
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef // indirect
github.com/evanphx/json-patch v4.5.0+incompatible
github.com/goccy/go-yaml v1.4.3 // indirect
github.com/googleapis/gnostic v0.2.0 // indirect
github.com/imdario/mergo v0.3.7 // indirect
github.com/prometheus/client_golang v0.9.2
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910
github.com/spf13/cobra v0.0.5
github.com/mattn/go-colorable v0.1.6 // indirect
github.com/mikefarah/yq/v3 v3.0.0-20200304043226-a06320f13c07 // indirect
github.com/onsi/ginkgo v1.12.0
github.com/onsi/gomega v1.7.1
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.0.0
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4
github.com/spf13/cobra v0.0.6
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.3.2
github.com/stretchr/objx v0.2.0 // indirect
github.com/spf13/viper v1.4.0
github.com/stretchr/testify v1.4.0
github.com/vektra/mockery v0.0.0-20181123154057-e78b021dcbb5
golang.org/x/tools v0.0.0-20200212213342-7a21e308cf6c // indirect
go.uber.org/zap v1.10.0
golang.org/x/exp v0.0.0-20200228211341-fcea875c7e85 // indirect
golang.org/x/sys v0.0.0-20200317113312-5766fd39f98d // indirect
golang.org/x/tools v0.0.0-20200316212524-3e76bee198d8 // indirect
gonum.org/v1/gonum v0.7.0
gopkg.in/inf.v0 v0.9.1 // indirect
k8s.io/api v0.0.0-20191025225708-5524a3672fbb
k8s.io/apimachinery v0.0.0-20191025225532-af6325b3a843
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
helm.sh/helm/v3 v3.1.2
k8s.io/api v0.17.2
k8s.io/apimachinery v0.17.2
k8s.io/cli-runtime v0.17.2
k8s.io/client-go v11.0.0+incompatible
k8s.io/code-generator v0.0.0-20190612205613-18da4a14b22b
k8s.io/gengo v0.0.0-20190822140433-26a664648505 // indirect
k8s.io/code-generator v0.17.2
k8s.io/klog v1.0.0
)

Expand Down
Loading