From 5703ceed75a5c6213bbdfed95c6002810c561248 Mon Sep 17 00:00:00 2001
From: Peter Leitzen <pleitzen@gitlab.com>
Date: Mon, 3 Mar 2025 12:58:17 +0100
Subject: [PATCH] Ensure that merge trains contain a specific list of CI jobs

The list of CI jobs run in "merge train" is static and we should ensure
that it only changes intentionally. Otherwise we could slow down the
merge train by accident (which we did in
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/172742).
---
 .../shared_context_and_examples.rb                       | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/spec/dot_gitlab_ci/ci_configuration_validation/shared_context_and_examples.rb b/spec/dot_gitlab_ci/ci_configuration_validation/shared_context_and_examples.rb
index a3c6e84ddca4..b9477e68c0d2 100644
--- a/spec/dot_gitlab_ci/ci_configuration_validation/shared_context_and_examples.rb
+++ b/spec/dot_gitlab_ci/ci_configuration_validation/shared_context_and_examples.rb
@@ -122,13 +122,18 @@
 
 RSpec.shared_examples 'merge train pipeline' do
   let(:ci_merge_request_event_type) { 'merge_train' }
+  let(:expected_job_names) do
+    %w[
+      dont-interrupt-me
+      pre-merge-checks
+    ]
+  end
 
   it "succeeds with expected job" do
     expect(pipeline.yaml_errors).to be_nil
     expect(pipeline.errors).to be_empty
     expect(pipeline.status).to eq('created')
-    expect(jobs).to include('pre-merge-checks')
-    expect(jobs).not_to include('upload-frontend-fixtures')
+    expect(jobs).to eq(expected_job_names)
   end
 end
 
-- 
GitLab