Skip to content

Instantly share code, notes, and snippets.

@lpabon
Created October 6, 2016 22:50
Show Gist options
  • Save lpabon/866c7718d944a1d4e993b834de40c34a to your computer and use it in GitHub Desktop.
Save lpabon/866c7718d944a1d4e993b834de40c34a to your computer and use it in GitHub Desktop.
final fixes
diff --git a/tests/functional/TestKubeSmokeTest/testHeketiRpc.sh b/tests/functional/TestKubeSmokeTest/testHeketiRpc.sh
index c28797a..c04509e 100755
--- a/tests/functional/TestKubeSmokeTest/testHeketiRpc.sh
+++ b/tests/functional/TestKubeSmokeTest/testHeketiRpc.sh
@@ -26,6 +26,29 @@ display_information() {
kubectl get nodes
}
+start_mock_gluster_container() {
+
+ # Use a busybox container
+ kubectl run gluster$1 \
+ --restart=Never \
+ --image=busybox \
+ --labels=glusterfs-node=gluster$1 \
+ --command -- sleep 10000 || fail "Unable to start gluster$1"
+
+ # Wait until it is running
+ while ! kubectl get pods | grep gluster$1 | grep "1/1" > /dev/null ; do
+ sleep 1
+ done
+
+ # Create fake gluster file
+ kubectl exec gluster$1 -- sh -c "echo '#!/bin/sh' > /bin/gluster" || fail "Unable to create /bin/gluster"
+ kubectl exec gluster$1 -- chmod +x /bin/gluster || fail "Unable to chmod +x /bin/gluster"
+
+ # Create fake bash file
+ kubectl exec gluster$1 -- sh -c "echo '#!/bin/sh' > /bin/bash" || fail "Unable to create /bin/bash"
+ kubectl exec gluster$1 -- chmod +x /bin/bash || fail "Unable to chmod +x /bin/bash"
+}
+
setup_all_pods() {
kubectl get nodes --show-labels
@@ -34,13 +57,16 @@ setup_all_pods() {
kubectl create -f ServiceAccount.yaml || fail "Unable to create a serviceAccount"
KUBESEC=$(kubectl get secrets | grep seracc | awk 'NR==1{print $1}')
-
KUBEAPI=https://$(minikube ip):8443
# Start Heketi
echo -e "\nStart Heketi container"
- sed 's\<ApiHost>\'"$KUBEAPI"'\g; s\<SecretName>\'"$KUBESEC"'\g' test-heketi-deployment.json | kubectl create -f - --validate=false || fail "Unable to start heketi container"
- sleep 30
+ sed 's\<ApiHost>\'"$KUBEAPI"'\g; s\<SecretName>\'"$KUBESEC"'\g' test-heketi-deployment.json | kubectl create -f - --validate=false || fail "Unable to start heketi container"
+
+ # Wait until it is running
+ while ! kubectl get pods | grep heketi | grep "1/1" > /dev/null ; do
+ sleep 1
+ done
# This blocks until ready
kubectl expose deployment heketi --type=NodePort || fail "Unable to expose heketi service"
@@ -49,11 +75,9 @@ setup_all_pods() {
export HEKETI_CLI_SERVER=$(minikube service heketi --url)
heketi-cli topology info
- echo -e "\nStart gluster container"
- sed 's\<hostname>\minikubevm\g' glusterfs-mock.json | kubectl create -f - --validate=false || fail "Unable to start gluster1"
-
- kubectl run gluster2 --image=ashiq/glusterfs-mock-container --labels=glusterfs-node=gluster2 || fail "Unable to start gluster2"
-
+ echo -e "\nStart mock gluster using busybox"
+ start_mock_gluster_container 1
+ start_mock_gluster_container 2
}
test_peer_probe() {
@@ -62,11 +86,17 @@ test_peer_probe() {
CLUSTERID=$(heketi-cli cluster list | sed -e '$!d')
- echo -e "\nAdd First Node"
- heketi-cli node add --zone=1 --cluster=$CLUSTERID --management-host-name=minikubevm --storage-host-name=minikubevm || fail "Unable to add gluster1"
-
- echo -e "\nAdd Second Node"
- heketi-cli node add --zone=2 --cluster=$CLUSTERID --management-host-name=gluster2 --storage-host-name=gluster2 || fail "Unable to add gluster2"
+ echo -e "\nAdd First Node"
+ heketi-cli node add --zone=1 \
+ --cluster=$CLUSTERID \
+ --management-host-name=gluster1 \
+ --storage-host-name=gluster1 || fail "Unable to add gluster1"
+
+ echo -e "\nAdd Second Node"
+ heketi-cli node add --zone=2 \
+ --cluster=$CLUSTERID \
+ --management-host-name=gluster2 \
+ --storage-host-name=gluster2 || fail "Unable to add gluster2"
echo -e "\nShow Topology"
heketi-cli topology info
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment