diff --git a/tests/cleanup.sh b/tests/cleanup.sh
index a7ba70850ba12f1868a6eccf4c3f5e88d9e74c4b..a2a09a447e9b844688e2fd04fbc25c668b04a14e 100755
--- a/tests/cleanup.sh
+++ b/tests/cleanup.sh
@@ -13,6 +13,11 @@ cleanup() {
 trap 'cleanup' EXIT INT TERM
 
 TEST_PREFIX="test-rapp"
+# Workaround to detect cloud functions created by GCP Minimal Site Monitoring module.
+# The cloud functions created by this module use `short_service_name`, (first 8 symbols).
+# https://gitlab.developers.cam.ac.uk/uis/devops/infra/terraform/gcp-site-monitoring/-/blob/master/locals.tf?ref_type=heads#L74
+# SHORT_TEST_PREFIX is used later in this script in "Cleaning up Cloud Functions..." block.
+SHORT_TEST_PREFIX="${TEST_PREFIX:0:8}"
 GCP_PROJECT="infra-testing-int-e2395220"
 GCP_PROJECT_META="infra-testing-meta-21f09a44"
 GCP_REGION="europe-west2"
@@ -45,7 +50,7 @@ done
 echo "Cleaning up Cloud Functions..."
 mapfile -t functions < <(
     gcloud --project="$GCP_PROJECT" functions list \
-        --filter="name ~ .*${TEST_PREFIX}.*" --format="value(name)"
+        --filter="name ~ .*${SHORT_TEST_PREFIX}.*" --format="value(name)"
 )
 
 for function in "${functions[@]}"; do