Skip to content

Commit b5fa92a

Browse files
authored
Create end to end testing deployment (#9)
Create end to end testing deployment
1 parent 39db3fb commit b5fa92a

File tree

4 files changed

+49
-1
lines changed

4 files changed

+49
-1
lines changed

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,15 @@ test: manifests generate generate-mocks fmt vet ## Run tests.
5555
test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.7.2/hack/setup-envtest.sh
5656
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./... -coverprofile cover.out
5757

58-
e2e-test: generate kubetest2 fmt vet
58+
KUBECTL=$(ENVTEST_ASSETS_DIR)/bin/kubectl
59+
TEST_CONFIG=$(shell pwd)/testconfig
60+
e2e-test: manifests kustomize kubetest2 fmt vet
5961
$(KUBETEST2-KIND) --cluster-name aws-cloudmap-mcs-e2e --up
62+
$(KUSTOMIZE) build config/crd | $(KUBECTL) apply -f -
63+
$(KUBECTL) create namespace aws-cloudmap-mcs-e2e
64+
$(KUBECTL) apply -f $(TEST_CONFIG)/e2e-deployment.yaml
65+
$(KUBECTL) apply -f $(TEST_CONFIG)/e2e-service-one.yaml
66+
$(KUBECTL) apply -f $(TEST_CONFIG)/e2e-export.yaml
6067
$(KUBETEST2-KIND) --cluster-name aws-cloudmap-mcs-e2e --down
6168

6269
##@ Build

testconfig/e2e-deployment.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# e2e-deployment.yaml
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: nginx-deployment
6+
labels:
7+
app: nginx
8+
spec:
9+
replicas: 5
10+
selector:
11+
matchLabels:
12+
app: nginx
13+
template:
14+
metadata:
15+
labels:
16+
app: nginx
17+
spec:
18+
containers:
19+
- name: nginx
20+
image: nginx:1.14.2
21+
ports:
22+
- containerPort: 80

testconfig/e2e-export.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# e2e-export.yaml
2+
3+
kind: ServiceExport
4+
apiVersion: multicluster.k8s.aws/v1alpha1
5+
metadata:
6+
namespace: aws-cloudmap-mcs-e2e
7+
name: e2e-service-one

testconfig/e2e-service-one.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# e2e-service-one.yaml
2+
kind: Service
3+
apiVersion: v1
4+
metadata:
5+
namespace: aws-cloudmap-mcs-e2e
6+
name: e2e-service-one
7+
spec:
8+
selector:
9+
app: nginx
10+
ports:
11+
- port: 8080
12+
targetPort: 80

0 commit comments

Comments
 (0)