diff --git a/ci_tests/run_basic_grb_test.sh b/ci_tests/run_basic_grb_test.sh
index 5cf26e02e99935c612b1269c8dd39b89d495b1e9..360fab127ad2fea50d8815daa76bb29d92c5dff8 100755
--- a/ci_tests/run_basic_grb_test.sh
+++ b/ci_tests/run_basic_grb_test.sh
@@ -9,32 +9,44 @@ error() {
     exit 1
 }
 
+install_charts() {
+    pushd geosphere-grb/chart
+    helm upgrade -v 2 --install --namespace $ns -f ../../ci_tests/values-grb-g16.yaml ${GRB_RELEASE_NAME} cspp-geo-grb/
+    popd
+}
+
+get_pod_name() {
+    release_name="$1"
+    kubectl -n $ns get pods --selector=app.kubernetes.io/instance=${release_name} -o name
+}
+
+run_grb_checks() {
+    count=0
+    while true; do
+      num_files=$(kubectl exec -n $ns ${GRB_POD_NAME} -c cspp-geo-grb-notifier -- ls -1 /dst | wc -l || echo 0)
+      let count=count+1
+      if [[ $num_files -gt 16 ]]; then
+          debug "Got at least 16 files"
+          break
+      fi
+      if [[ $count -gt 10 ]]; then
+          error "Took too long for GRB to produce files"
+      fi
+      sleep 10
+    done
+}
+
 set -e
 
 ns=$(./helpers/get_namespace.sh)
 source ci_tests/get_release_names.sh
-
-pushd geosphere-grb/chart
-helm upgrade -v 2 --install --namespace $ns -f ../../ci_tests/values-grb-g16.yaml ${GRB_RELEASE_NAME} cspp-geo-grb/
-popd
+install_charts
 
 # give kubernetes a bit to create the pod
 sleep 30
 
-debug "Getting pod name"
-GRB_POD_NAME=$(kubectl -n $ns get pods --selector=app.kubernetes.io/instance=${GRB_RELEASE_NAME} -o name)
+debug "Getting GRB pod name"
+GRB_POD_NAME=$(get_pod_name "${GRB_RELEASE_NAME}")
 debug "GRB pod name: ${GRB_POD_NAME}"
-count=0
-while true; do
-  num_files=$(kubectl exec -n $ns ${GRB_POD_NAME} -c cspp-geo-grb-notifier -- ls -1 /dst | wc -l || echo 0)
-  let count=count+1
-  if [[ $num_files -gt 16 ]]; then
-      debug "Got at least 16 files"
-      break
-  fi
-  if [[ $count -gt 10 ]]; then
-      error "Took too long for GRB to produce files"
-  fi
-  sleep 10
-done
 
+run_grb_checks || error "GRB checks failed"