From ab8d37690a4258d3e172807bd4916b328c9ef9b7 Mon Sep 17 00:00:00 2001 From: Jay McCure Date: Wed, 10 Sep 2025 09:51:14 +1000 Subject: [PATCH 1/7] Tests: use chrome 138 --- .gitlab/ci/version.yml | 2 +- qa/Dockerfile | 2 +- spec/features/snippets/user_creates_snippet_spec.rb | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.gitlab/ci/version.yml b/.gitlab/ci/version.yml index 3d7ac30ab2d579..aab3b3de2c6b56 100644 --- a/.gitlab/ci/version.yml +++ b/.gitlab/ci/version.yml @@ -1,6 +1,6 @@ variables: BUILD_OS: "debian" - CHROME_VERSION: "123" + CHROME_VERSION: "138" DOCKER_VERSION: "27.4.1" EXIFTOOL_VERSION: "12.60" GCLOUD_VERSION: "413" diff --git a/qa/Dockerfile b/qa/Dockerfile index a10db24c2f0566..4a66992bddabfa 100644 --- a/qa/Dockerfile +++ b/qa/Dockerfile @@ -1,5 +1,5 @@ ARG BUILD_OS=debian -ARG CHROME_VERSION=123 +ARG CHROME_VERSION=138 ARG DOCKER_VERSION=24.0.5 ARG GCLOUD_VERSION=413 ARG GIT_VERSION=2.51 diff --git a/spec/features/snippets/user_creates_snippet_spec.rb b/spec/features/snippets/user_creates_snippet_spec.rb index e49b4707e2ed86..4245839cfd93b4 100644 --- a/spec/features/snippets/user_creates_snippet_spec.rb +++ b/spec/features/snippets/user_creates_snippet_spec.rb @@ -146,9 +146,7 @@ def fill_form # not anymore as requests when they come straight from memory cache. # accept_confirm is needed because of https://gitlab.com/gitlab-org/gitlab/-/issues/262102 reqs = inspect_requests do - visit("#{link}?ran=#{SecureRandom.base64(20)}") do - page.driver.browser.switch_to.alert.accept - end + visit("#{link}?ran=#{SecureRandom.base64(20)}") end expect(reqs.first.status_code).to eq(200) end -- GitLab From 628a1d30df5c29d4bff6df0187b3c1eec22b01ec Mon Sep 17 00:00:00 2001 From: Jay McCure Date: Wed, 10 Sep 2025 12:40:57 +1000 Subject: [PATCH 2/7] Increase ulimits for tests --- .gitlab/ci/rails/shared.gitlab-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab/ci/rails/shared.gitlab-ci.yml b/.gitlab/ci/rails/shared.gitlab-ci.yml index ab1f1af7fd8dbd..9e1f7b94d5862d 100644 --- a/.gitlab/ci/rails/shared.gitlab-ci.yml +++ b/.gitlab/ci/rails/shared.gitlab-ci.yml @@ -112,6 +112,10 @@ include: # spec/lib, yet background migration tests are also sitting there, # and they should run on their own jobs so we don't need to run them # in unit tests again. + - echo "Limits set: FD=$(ulimit -n), Processes=$(ulimit -u)" + - ulimit -n 65536 + - ulimit -u 4096 + - echo "Limits set: FD=$(ulimit -n), Processes=$(ulimit -u)" - rspec_section rspec_parallelized_job "--fail-fast=${RSPEC_FAIL_FAST_THRESHOLD} --tag ~quarantine --tag ~level:background_migration --tag ~click_house" after_script: # We need this at the very top, because the section_start/section_end logic is defined there. -- GitLab From 8dfc8d762d4f956d29a4a8d29cfb23eca805740a Mon Sep 17 00:00:00 2001 From: Jay McCure Date: Wed, 10 Sep 2025 13:16:29 +1000 Subject: [PATCH 3/7] Increase ulimits for tests --- .gitlab/ci/rails/shared.gitlab-ci.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.gitlab/ci/rails/shared.gitlab-ci.yml b/.gitlab/ci/rails/shared.gitlab-ci.yml index 9e1f7b94d5862d..94436a299c1ee1 100644 --- a/.gitlab/ci/rails/shared.gitlab-ci.yml +++ b/.gitlab/ci/rails/shared.gitlab-ci.yml @@ -112,11 +112,12 @@ include: # spec/lib, yet background migration tests are also sitting there, # and they should run on their own jobs so we don't need to run them # in unit tests again. - - echo "Limits set: FD=$(ulimit -n), Processes=$(ulimit -u)" - - ulimit -n 65536 - - ulimit -u 4096 - - echo "Limits set: FD=$(ulimit -n), Processes=$(ulimit -u)" - - rspec_section rspec_parallelized_job "--fail-fast=${RSPEC_FAIL_FAST_THRESHOLD} --tag ~quarantine --tag ~level:background_migration --tag ~click_house" + - | + echo "Limits set: FD=$(ulimit -n), Processes=$(ulimit -u)" + ulimit -n 65536 + ulimit -u 4096 + echo "Limits set: FD=$(ulimit -n), Processes=$(ulimit -u)" + rspec_section rspec_parallelized_job "--fail-fast=${RSPEC_FAIL_FAST_THRESHOLD} --tag ~quarantine --tag ~level:background_migration --tag ~click_house" after_script: # We need this at the very top, because the section_start/section_end logic is defined there. - source scripts/utils.sh -- GitLab From cb53fad958420b4fdd13a6fe8ae2e3777cd28999 Mon Sep 17 00:00:00 2001 From: Jay McCure Date: Wed, 10 Sep 2025 16:18:15 +1000 Subject: [PATCH 4/7] Edit capybara.rb --- spec/support/capybara.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb index 7d58a81ede1577..14b101873c6e0d 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -47,6 +47,30 @@ # Ensure the Chrome locale is `en` so all dates are deterministic regardless of local settings options.add_preference('intl.accept_languages', 'en') + if ENV['CI'] || ENV['CI_SERVER'] + # Use the RAM disk if available, otherwise fallback to /tmp + chrome_dir = ENV['CHROME_TMPDIR'] || '/tmp' + + # Create unique directories for this process + process_dir = "#{chrome_dir}/chrome-#{Process.pid}-#{Time.now.to_i}" + FileUtils.mkdir_p(process_dir) + + # Use RAM-based directories for everything + options.add_argument("--user-data-dir=#{process_dir}/profile") + options.add_argument("--disk-cache-dir=#{process_dir}/cache") + options.add_argument("--crash-dumps-dir=#{process_dir}/crashes") + + # REMOVE or conditionally add disable-dev-shm-usage + # Since we're using our own tmpfs, we might not need this flag + if ENV['CHROME_TMPDIR'] && ENV['CHROME_TMPDIR'].include?('chrome-mem') + puts "Using RAM disk, skipping disable-dev-shm-usage flag" + # Don't add the flag - let Chrome use the fast path + else + puts "Using disk, adding disable-dev-shm-usage flag" + options.add_argument("disable-dev-shm-usage") + end + end + unless ENV['WEBDRIVER_HEADLESS'] =~ /^(false|no|0)$/i || ENV['CHROME_HEADLESS'] =~ /^(false|no|0)$/i # Run headless by default unless WEBDRIVER_HEADLESS specified options.add_argument("headless") -- GitLab From 516836dff6683c5e9e0180421ba58c591a425489 Mon Sep 17 00:00:00 2001 From: Jay McCure Date: Wed, 10 Sep 2025 16:18:24 +1000 Subject: [PATCH 5/7] Apply 1 suggestion(s) to 1 file(s) --- .gitlab/ci/rails/shared.gitlab-ci.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.gitlab/ci/rails/shared.gitlab-ci.yml b/.gitlab/ci/rails/shared.gitlab-ci.yml index 94436a299c1ee1..c650f9c373cbcd 100644 --- a/.gitlab/ci/rails/shared.gitlab-ci.yml +++ b/.gitlab/ci/rails/shared.gitlab-ci.yml @@ -113,10 +113,18 @@ include: # and they should run on their own jobs so we don't need to run them # in unit tests again. - | - echo "Limits set: FD=$(ulimit -n), Processes=$(ulimit -u)" - ulimit -n 65536 - ulimit -u 4096 - echo "Limits set: FD=$(ulimit -n), Processes=$(ulimit -u)" + echo "=== Setting up Chrome memory optimization ===" + df -h /dev/shm + # Create a 1GB RAM-based tmpfs for Chrome (you have 3.9GB available) + mkdir -p /tmp/chrome-mem + if mount -t tmpfs -o size=1G tmpfs /tmp/chrome-mem; then + echo "✓ Created 1GB RAM disk at /tmp/chrome-mem" + export CHROME_TMPDIR=/tmp/chrome-mem + df -h /tmp/chrome-mem + else + echo "⚠ Could not create tmpfs, using regular disk" + export CHROME_TMPDIR=/tmp + fi rspec_section rspec_parallelized_job "--fail-fast=${RSPEC_FAIL_FAST_THRESHOLD} --tag ~quarantine --tag ~level:background_migration --tag ~click_house" after_script: # We need this at the very top, because the section_start/section_end logic is defined there. -- GitLab From 6dd1b73253262f6bad8021bcc01c091e26c6e0e5 Mon Sep 17 00:00:00 2001 From: Jay McCure Date: Wed, 10 Sep 2025 16:22:49 +1000 Subject: [PATCH 6/7] Edit capybara.rb --- spec/support/capybara.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb index 14b101873c6e0d..3e629b2a336452 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -84,9 +84,6 @@ options.add_argument("disable-backgrounding-occluded-windows") end - # Disable /dev/shm use in CI. See https://gitlab.com/gitlab-org/gitlab/issues/4252 - options.add_argument("disable-dev-shm-usage") if ENV['CI'] || ENV['CI_SERVER'] - # Set chrome default download path if ENV['DEFAULT_CHROME_DOWNLOAD_PATH'] options.add_preference("download.default_directory", ENV['DEFAULT_CHROME_DOWNLOAD_PATH']) -- GitLab From 486add010dfeb6a907a9cc51664795fd2e2d38c5 Mon Sep 17 00:00:00 2001 From: Jay McCure Date: Wed, 10 Sep 2025 16:54:55 +1000 Subject: [PATCH 7/7] Edit capybara.rb --- spec/support/capybara.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb index 3e629b2a336452..4156516090324e 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -41,6 +41,8 @@ # Chrome won't work properly in a Docker container in sandbox mode options.add_argument("no-sandbox") + options.add_argument("--disable-features=ParallelDownloading") + options.add_argument("--disable-http2") # HTTP/1.1 has different connection behavior options.add_argument("disable-search-engine-choice-screen") -- GitLab