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

Add smoke tests #528

Merged
merged 1 commit into from
Feb 3, 2022
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
ENV GOPROXY https://goproxy.io,direct
ENV GOPROXY https://proxy.golang.org,direct
Amulyam24 marked this conversation as resolved.
Show resolved Hide resolved
RUN go mod download

# Copy the go source
Expand Down
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ CORE_MANIFEST_FILE := infrastructure-components
CORE_CONFIG_DIR := config/default
CORE_NAMESPACE := capi-ibmcloud-system

PATH := $(abspath $(TOOLS_BIN_DIR)):$(PATH)
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
Expand Down Expand Up @@ -168,9 +169,9 @@ ARTIFACTS ?= $(REPO_ROOT)/_artifacts
SKIP_CLEANUP ?= false
SKIP_CREATE_MGMT_CLUSTER ?= false

#Run the end-to-end tests
# Run the end-to-end tests
.PHONY: test-e2e
test-e2e: $(KUBECTL) $(GINKGO) $(ENVSUBST) set-flavor e2e-image
test-e2e: $(KUBECTL) $(GINKGO) $(KUSTOMIZE) $(ENVSUBST) set-flavor e2e-image
$(ENVSUBST) < $(E2E_CONF_FILE) > $(E2E_CONF_FILE_ENVSUBST)
$(GINKGO) $(GINKGO_ARGS) ./test/e2e -- \
-e2e.artifacts-folder="$(ARTIFACTS)" \
Expand All @@ -179,6 +180,11 @@ test-e2e: $(KUBECTL) $(GINKGO) $(ENVSUBST) set-flavor e2e-image
-e2e.use-existing-cluster=$(SKIP_CREATE_MGMT_CLUSTER) \
-e2e.flavor="$(E2E_FLAVOR)"

# Basic checks for deploying kind cluster and required providers
.PHONY: test-sanity
test-sanity:
GINKGO_FOCUS="Run Sanity tests" $(MAKE) test-e2e

## --------------------------------------
## Docker
## --------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ require (
k8s.io/client-go v0.23.0
k8s.io/klog/v2 v2.30.0
k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b
sigs.k8s.io/cluster-api v1.1.0-rc.0
sigs.k8s.io/cluster-api/test v1.1.0-rc.0
sigs.k8s.io/cluster-api v1.1.0
sigs.k8s.io/cluster-api/test v1.1.0
sigs.k8s.io/controller-runtime v0.11.0
)

Expand Down Expand Up @@ -138,4 +138,4 @@ require (
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.1.0-rc.0
replace sigs.k8s.io/cluster-api => sigs.k8s.io/cluster-api v1.1.0
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1807,10 +1807,10 @@ rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.14/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.25/go.mod h1:Mlj9PNLmG9bZ6BHFwFKDo5afkpWyUISkb9Me0GnK66I=
sigs.k8s.io/cluster-api v1.1.0-rc.0 h1:YLNabhJpbfuujnJUsR2wONBy+GU5ji9RrZb2SokG4vQ=
sigs.k8s.io/cluster-api v1.1.0-rc.0/go.mod h1:aSxmmNwDjmg9rDaL0RhRELpGX9uSTTwLF02AMtk/XGY=
sigs.k8s.io/cluster-api/test v1.1.0-rc.0 h1:U0HK82eHJJq1H3uMSf26BOOGu8ioIXuGNIoUAhvISpE=
sigs.k8s.io/cluster-api/test v1.1.0-rc.0/go.mod h1:ct7zQrWXsYIAhL/lMLFPfCAqGLDBTEzx+AtwIXpI45o=
sigs.k8s.io/cluster-api v1.1.0 h1:zJJzIUezEveYK3Ljmk/jku+DYd96RP5bZ181l2W9gVg=
sigs.k8s.io/cluster-api v1.1.0/go.mod h1:aSxmmNwDjmg9rDaL0RhRELpGX9uSTTwLF02AMtk/XGY=
sigs.k8s.io/cluster-api/test v1.1.0 h1:eBVFCWxu9/fb/By02uFjOreG9GAd9eax9uZKsCXP58s=
sigs.k8s.io/cluster-api/test v1.1.0/go.mod h1:ct7zQrWXsYIAhL/lMLFPfCAqGLDBTEzx+AtwIXpI45o=
sigs.k8s.io/controller-runtime v0.11.0 h1:DqO+c8mywcZLFJWILq4iktoECTyn30Bkj0CwgqMpZWQ=
sigs.k8s.io/controller-runtime v0.11.0/go.mod h1:KKwLiTooNGu+JmLZGn9Sl3Gjmfj66eMbCQznLP5zcqA=
sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 h1:fD1pz4yfdADVNfFmcP2aBEtudwUQ1AlLnRBALr33v3s=
Expand Down
26 changes: 26 additions & 0 deletions scripts/ci-smoke-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

# Copyright 2022 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -o errexit
set -o nounset
set -o pipefail

REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
# shellcheck source=../hack/ensure-go.sh
source "${REPO_ROOT}/hack/ensure-go.sh"

echo "**** Running basic checks by deploying the required CAPI providers on a kind cluster ***"
cd "${REPO_ROOT}" && make test-sanity
12 changes: 6 additions & 6 deletions test/e2e/config/ibmcloud-e2e-powervs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@ providers:
- name: cluster-api
type: CoreProvider
versions:
- name: v1.0.2
value: https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.0.2/core-components.yaml
- name: v1.1.0
value: https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.1.0/core-components.yaml
type: url
files:
- sourcePath: "${PWD}/test/e2e/data/shared/metadata.yaml"
- name: kubeadm
type: BootstrapProvider
versions:
- name: v1.0.2
value: https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.0.2/bootstrap-components.yaml
- name: v1.1.0
value: https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.1.0/bootstrap-components.yaml
type: url
files:
- sourcePath: "${PWD}/test/e2e/data/shared/metadata.yaml"
- name: kubeadm
type: ControlPlaneProvider
versions:
- name: v1.0.2
value: https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.0.2/control-plane-components.yaml
- name: v1.1.0
value: https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.1.0/control-plane-components.yaml
type: url
files:
- sourcePath: "${PWD}/test/e2e/data/shared/metadata.yaml"
Expand Down
3 changes: 3 additions & 0 deletions test/e2e/data/shared/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
# update this file only when a new major or minor version is released
apiVersion: clusterctl.cluster.x-k8s.io/v1alpha3
releaseSeries:
- major: 1
minor: 1
contract: v1beta1
- major: 1
minor: 0
contract: v1beta1
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ func initBootstrapCluster(bootstrapClusterProxy framework.ClusterProxy, config *
}, config.GetIntervals(bootstrapClusterProxy.GetName(), "wait-controllers")...)
}

var _ = Describe("Run Sanity tests", func() {
// TO DO- Add additional testcases for sanity checks
})

func tearDown(bootstrapClusterProvider bootstrap.ClusterProvider, bootstrapClusterProxy framework.ClusterProxy) {
if bootstrapClusterProxy != nil {
bootstrapClusterProxy.Dispose(context.TODO())
Expand Down