Skip to content

Commit 472438d

Browse files
niladrihprateekpandey14
authored andcommitted
chore(ci): run integration test on PRs (#80)
Signed-off-by: Niladri Halder <[email protected]>
1 parent 9048c48 commit 472438d

File tree

6 files changed

+140
-43
lines changed

6 files changed

+140
-43
lines changed

.github/workflows/build.yml

Lines changed: 61 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
runs-on: ubuntu-latest
4646
steps:
4747
- name: Set up Go 1.16
48-
uses: actions/setup-go@v1
48+
uses: actions/setup-go@v2
4949
with:
5050
go-version: 1.16.6
5151

@@ -65,9 +65,11 @@ jobs:
6565
runs-on: ubuntu-latest
6666
needs: ['lint', 'unit-test']
6767
steps:
68-
- name: Checkout
69-
uses: actions/checkout@v2
70-
68+
- name: Set up Go 1.16
69+
uses: actions/setup-go@v2
70+
with:
71+
go-version: 1.16.6
72+
7173
- name: Set Image Org
7274
# sets the default IMAGE_ORG to openebs
7375
run: |
@@ -105,12 +107,12 @@ jobs:
105107
run: |
106108
echo "${{ steps.docker_meta.outputs.tags }}"
107109
108-
- name: Setup QEMU
110+
- name: Set up QEMU
109111
uses: docker/setup-qemu-action@v1
110112
with:
111113
platforms: all
112114

113-
- name: Setup Docker Buildx
115+
- name: Set up Docker Buildx
114116
id: buildx
115117
uses: docker/setup-buildx-action@v1
116118
with:
@@ -129,12 +131,16 @@ jobs:
129131
username: ${{ secrets.QUAY_USERNAME }}
130132
password: ${{ secrets.QUAY_TOKEN }}
131133

132-
- name: Build and Push Image
134+
- name: Checkout
135+
uses: actions/checkout@v2
136+
137+
- name: Build and Push multi-arch Image
133138
uses: docker/build-push-action@v2
134139
with:
135140
context: .
136141
file: ./buildscripts/provisioner-localpv/provisioner-localpv.Dockerfile
137142
push: true
143+
load: false
138144
platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le
139145
tags: |
140146
${{ steps.docker_meta.outputs.tags }}
@@ -143,6 +149,53 @@ jobs:
143149
DBUILD_REPO_URL=https://github.com/openebs/dynamic-localpv-provisioner
144150
DBUILD_SITE_URL=https://openebs.io
145151
152+
integration-test:
153+
runs-on: ubuntu-latest
154+
needs: ['lint', 'unit-test']
155+
steps:
156+
- name: Set up Go 1.16
157+
uses: actions/setup-go@v2
158+
with:
159+
go-version: 1.16.6
160+
161+
- name: Set up Docker Buildx
162+
id: buildx
163+
uses: docker/setup-buildx-action@v1
164+
with:
165+
version: v0.5.1
166+
167+
- name: Checkout
168+
uses: actions/checkout@v2
169+
170+
- name: Build Image
171+
uses: docker/build-push-action@v2
172+
with:
173+
context: .
174+
file: ./buildscripts/provisioner-localpv/provisioner-localpv.Dockerfile
175+
push: false
176+
load: true
177+
platforms: linux/amd64
178+
tags: |
179+
openebs/provisioner-localpv:ci
180+
181+
- name: Set up Minikube
182+
uses: manusa/[email protected]
183+
with:
184+
minikube version: 'v1.22.0'
185+
kubernetes version: 'v1.22.0'
186+
driver: none
187+
188+
- name: Set up Ginkgo
189+
run: |
190+
go get github.com/onsi/ginkgo/[email protected]
191+
ginkgo version || exit 1
192+
193+
- name: Hostpath Integration Test
194+
run: |
195+
sed 's/imagePullPolicy: IfNotPresent/imagePullPolicy: Never/g' deploy/kubectl/hostpath-operator.yaml | kubectl apply -f -
196+
kubectl apply -f deploy/kubectl/openebs-hostpath-sc.yaml
197+
make hostpath-integration-test
198+
146199
localpv-e2e:
147200
runs-on: ubuntu-latest
148201
steps:
@@ -168,4 +221,4 @@ jobs:
168221
load: false
169222
platforms: linux/amd64
170223
tags: |
171-
${{ env.IMAGE_ORG }}/localpv-e2e:ci
224+
${{ env.IMAGE_ORG }}/localpv-e2e:ci

.github/workflows/pull_request.yml

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
runs-on: ubuntu-latest
4343
steps:
4444
- name: Set up Go 1.16
45-
uses: actions/setup-go@v1
45+
uses: actions/setup-go@v2
4646
with:
4747
go-version: 1.16.6
4848

@@ -62,30 +62,83 @@ jobs:
6262
runs-on: ubuntu-latest
6363
needs: ['lint', 'unit-test']
6464
steps:
65-
- name: Checkout
66-
uses: actions/checkout@v2
65+
- name: Set up Go 1.16
66+
uses: actions/setup-go@v2
67+
with:
68+
go-version: 1.16.6
6769

6870
- name: Setup QEMU
6971
uses: docker/setup-qemu-action@v1
7072
with:
7173
platforms: all
7274

73-
- name: Setup Docker Buildx
75+
- name: Set up Docker Buildx
7476
id: buildx
7577
uses: docker/setup-buildx-action@v1
7678
with:
7779
version: v0.5.1
7880

79-
- name: Build Image
81+
- name: Checkout
82+
uses: actions/checkout@v2
83+
84+
- name: Build multi-arch Image
8085
uses: docker/build-push-action@v2
8186
with:
8287
context: .
8388
file: ./buildscripts/provisioner-localpv/provisioner-localpv.Dockerfile
8489
push: false
90+
load: false
8591
platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le
8692
tags: |
8793
openebs/provisioner-localpv:ci
8894
95+
integration-test:
96+
runs-on: ubuntu-latest
97+
needs: ['lint', 'unit-test']
98+
steps:
99+
- name: Set up Go 1.16
100+
uses: actions/setup-go@v2
101+
with:
102+
go-version: 1.16.6
103+
104+
- name: Set up Docker Buildx
105+
id: buildx
106+
uses: docker/setup-buildx-action@v1
107+
with:
108+
version: v0.5.1
109+
110+
- name: Checkout
111+
uses: actions/checkout@v2
112+
113+
- name: Build Image
114+
uses: docker/build-push-action@v2
115+
with:
116+
context: .
117+
file: ./buildscripts/provisioner-localpv/provisioner-localpv.Dockerfile
118+
push: false
119+
load: true
120+
platforms: linux/amd64
121+
tags: |
122+
openebs/provisioner-localpv:ci
123+
124+
- name: Set up Minikube
125+
uses: manusa/[email protected]
126+
with:
127+
minikube version: 'v1.22.0'
128+
kubernetes version: 'v1.22.0'
129+
driver: none
130+
131+
- name: Set up Ginkgo
132+
run: |
133+
go get github.com/onsi/ginkgo/[email protected]
134+
ginkgo version || exit 1
135+
136+
- name: Hostpath Integration Test
137+
run: |
138+
sed 's/imagePullPolicy: IfNotPresent/imagePullPolicy: Never/g' deploy/kubectl/hostpath-operator.yaml | kubectl apply -f -
139+
kubectl apply -f deploy/kubectl/openebs-hostpath-sc.yaml
140+
make hostpath-integration-test
141+
89142
localpv-e2e:
90143
runs-on: ubuntu-latest
91144
steps:
@@ -100,4 +153,4 @@ jobs:
100153
load: false
101154
platforms: linux/amd64
102155
tags: |
103-
openebs/localpv-e2e:ci
156+
openebs/localpv-e2e:ci

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ ifeq (${DBUILD_SITE_URL}, )
9494
export DBUILD_SITE_URL
9595
endif
9696

97+
# Specify the kubeconfig path to a Kubernetes cluster
98+
# to run Hostpath integration tests
99+
ifeq (${KUBECONFIG}, )
100+
KUBECONFIG=${HOME}/.kube/config
101+
export KUBECONFIG
102+
endif
103+
97104
export DBUILD_ARGS=--build-arg DBUILD_DATE=${DBUILD_DATE} --build-arg DBUILD_REPO_URL=${DBUILD_REPO_URL} --build-arg DBUILD_SITE_URL=${DBUILD_SITE_URL} --build-arg BRANCH=${BRANCH} --build-arg RELEASE_TAG=${RELEASE_TAG}
98105

99106
.PHONY: all
@@ -132,6 +139,11 @@ testv: format
132139
@echo "--> Running go test verbose" ;
133140
@go test -v $(PACKAGES)
134141

142+
# Requires KUBECONFIG env and 'ginkgo' binary
143+
.PHONY: hostpath-integration-test
144+
hostpath-integration-test:
145+
@cd tests && ginkgo -v --focus="TEST HOSTPATH LOCAL PV"
146+
135147
.PHONY: format
136148
format:
137149
@echo "--> Running go fmt"
Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,11 @@ rules:
2424
resources: ["nodes", "nodes/proxy"]
2525
verbs: ["*"]
2626
- apiGroups: ["*"]
27-
resources: ["namespaces", "services", "pods", "pods/exec", "deployments", "deployments/finalizers", "replicationcontrollers", "replicasets", "events", "endpoints", "configmaps", "secrets", "jobs", "cronjobs"]
27+
resources: ["namespaces", "services", "pods", "deployments", "events", "endpoints", "configmaps", "jobs"]
2828
verbs: ["*"]
29-
- apiGroups: ["*"]
30-
resources: ["statefulsets", "daemonsets"]
31-
verbs: ["*"]
32-
- apiGroups: ["*"]
33-
resources: ["resourcequotas", "limitranges"]
34-
verbs: ["list", "watch"]
35-
- apiGroups: ["*"]
36-
resources: ["ingresses", "horizontalpodautoscalers", "verticalpodautoscalers", "poddisruptionbudgets", "certificatesigningrequests"]
37-
verbs: ["list", "watch"]
3829
- apiGroups: ["*"]
3930
resources: ["storageclasses", "persistentvolumeclaims", "persistentvolumes"]
4031
verbs: ["*"]
41-
- apiGroups: ["apiextensions.k8s.io"]
42-
resources: ["customresourcedefinitions"]
43-
verbs: [ "get", "list", "create", "update", "delete", "patch"]
44-
- apiGroups: ["openebs.io"]
45-
resources: [ "*"]
46-
verbs: ["*"]
47-
- nonResourceURLs: ["/metrics"]
48-
verbs: ["get"]
4932
---
5033
# Bind the Service Account with the Role Privileges.
5134
# TODO: Check if default account also needs to be there
@@ -90,7 +73,7 @@ spec:
9073
containers:
9174
- name: openebs-provisioner-hostpath
9275
imagePullPolicy: IfNotPresent
93-
image: openebs/provisioner-localpv-ci:dev-120403
76+
image: openebs/provisioner-localpv:ci
9477
env:
9578
# OPENEBS_IO_K8S_MASTER enables openebs provisioner to connect to K8s
9679
# based on this address. This is ignored if empty.
@@ -119,13 +102,17 @@ spec:
119102
- name: OPENEBS_IO_ENABLE_ANALYTICS
120103
value: "true"
121104
- name: OPENEBS_IO_INSTALLER_TYPE
122-
value: "openebs-operator-lite"
105+
value: "openebs-operator-hostpath"
123106
- name: OPENEBS_IO_HELPER_IMAGE
124-
value: "openebs/linux-utils:2.3.0"
107+
value: "openebs/linux-utils:ci"
125108
# LEADER_ELECTION_ENABLED is used to enable/disable leader election. By default
126109
# leader election is enabled.
127110
#- name: LEADER_ELECTION_ENABLED
128111
# value: "true"
112+
# OPENEBS_IO_IMAGE_PULL_SECRETS environment variable is used to pass the image pull secrets
113+
# to the helper pod launched by local-pv hostpath provisioner
114+
#- name: OPENEBS_IO_IMAGE_PULL_SECRETS
115+
# value: ""
129116
# Process name used for matching is limited to the 15 characters
130117
# present in the pgrep output.
131118
# So fullname can't be used here with pgrep (>15 chars).A regular expression

tests/suite_test.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,6 @@ var _ = BeforeSuite(func() {
6262
)
6363
Expect(provPodCount).To(Equal(1))
6464

65-
By("waiting for openebs-ndm-operator pod to come into running state")
66-
ndmPodCount := ops.GetPodRunningCountEventually(
67-
string(artifacts.OpenebsNamespace),
68-
string(artifacts.OpenEBSNDMOperatorLabelSelector),
69-
1,
70-
)
71-
Expect(ndmPodCount).To(Equal(1))
72-
7365
By("building a namespace")
7466
namespaceObj, err = ns.NewBuilder().
7567
WithGenerateName(namespace).

0 commit comments

Comments
 (0)