Skip to content

Commit

Permalink
Install PV before test setup and fix deamon set tests
Browse files Browse the repository at this point in the history
  • Loading branch information
akashshinde committed May 5, 2020
1 parent a2b9b3d commit 4884003
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 4 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
SHELL = /bin/bash

.PHONY: acceptance
acceptance:
acceptance: ensure-cluster-setup
@scripts/acceptance.sh

ensure-cluster-setup:
@scripts/ensure-cluster-setup.sh

.PHONY: github-actions-ci
github-actions-ci:
@scripts/github-actions-ci.sh
Expand Down
7 changes: 6 additions & 1 deletion lib/Kubectl.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@ def pods_with_prefix_are_running(self, namespace, pod_prefix, num_expected):
cmd = '[ `kubectl get pods --namespace='+namespace
cmd += ' | grep ^'+pod_prefix+' | awk \'{print $2 "--" $3}\''
cmd += ' | grep -E "^([1-9][0-9]*)/\\1--Running" | wc -l` == '+num_expected+' ]'
self.run_command(kind_auth_wrap(cmd))
self.run_command(kind_auth_wrap(cmd))

def deamon_set_pods_with_prefix(self, namespace,pod_prefix):
cmd = 'kubectl get nodes | grep Ready | wc -l'
self.run_command(kind_auth_wrap(cmd))
self.pods_with_prefix_are_running(namespace, pod_prefix, self.stdout)
36 changes: 36 additions & 0 deletions scripts/ensure-cluster-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash -e
#
# Copyright The Helm 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.

# Create a persistance volume with standard storageclass
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: PersistentVolume
metadata:
name: test-pv
spec:
capacity:
storage: 10Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: standard
nfs:
path: /tmp
server: 172.17.0.2
EOF

echo "Sleep for 10 secs"
sleep 10
2 changes: 1 addition & 1 deletion testdata/charts/nginx/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ spec:
- "echo bar | grep {{ if .Values.breakme }}foo{{ else }}bar{{ end }}"

---
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "nginx.fullname" . }}-v1beta1
Expand Down
2 changes: 1 addition & 1 deletion testsuites/kubernetes_versions.robot
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Verify --wait flag works as expected

Kubectl.Pods with prefix are running default wait-flag-good-nginx-ext- 3
Kubectl.Return code should be 0
Kubectl.Pods with prefix are running default wait-flag-good-nginx-fluentd-es- 1
Kubectl.Deamon Set Pods With Prefix default wait-flag-good-nginx-fluentd-es-
Kubectl.Return code should be 0
Kubectl.Pods with prefix are running default wait-flag-good-nginx-v1- 3
Kubectl.Return code should be 0
Expand Down

0 comments on commit 4884003

Please sign in to comment.