diff --git a/tests/unit.gitlab-ci.yml b/tests/unit.gitlab-ci.yml
index e307e3d6437660628aff3db83bce1f04f67e993b..7490a0180eee13fe4106b7506474cab64a98e1df 100644
--- a/tests/unit.gitlab-ci.yml
+++ b/tests/unit.gitlab-ci.yml
@@ -160,10 +160,13 @@ gitlab-tofu-init-with-prepared-registry-token:
     - |
       cat <<'EOF' > test.sh
       set -x
-      export TF_TOKEN_gitlab_com=mysecrettoken
+      # NOTE: as part of the tst fixture, we need to overwrite the CI_SERVER_HOST,
+      # so that this test also properly works on GitLab self-managed.
+      export CI_SERVER_HOST=gitlab.example.com
+      export TF_TOKEN_gitlab_example_com=mysecrettoken
       . $(which gitlab-tofu)
       terraform_authenticate_private_registry
-      test "$TF_TOKEN_gitlab_com" = "mysecrettoken"
+      test "$TF_TOKEN_gitlab_example_com" = "mysecrettoken"
       EOF
     - $SHELL test.sh
   parallel:
@@ -186,9 +189,12 @@ gitlab-tofu-init-without-prepared-registry-token:
     - |
       cat <<'EOF' > test.sh
       set -x
+      # NOTE: as part of the tst fixture, we need to overwrite the CI_SERVER_HOST,
+      # so that this test also properly works on GitLab self-managed.
+      export CI_SERVER_HOST=gitlab.example.com
       . $(which gitlab-tofu)
       terraform_authenticate_private_registry
-      test -n "$TF_TOKEN_gitlab_com"
+      test -n "$TF_TOKEN_gitlab_example_com"
       EOF
     - $SHELL test.sh
   parallel: