Skip to content

A platform for community discussion. Free, open, simple.

DEV: Fix the build due to changes in how Redis is installed in the base image (#42500)

Alan Guo Xiang Tan8a835162980e
diff --git a/.github/workflows/migration-tests.yml b/.github/workflows/migration-tests.yml
index 0cac945b93b..bd8135c60d4 100644
--- a/.github/workflows/migration-tests.yml
+++ b/.github/workflows/migration-tests.yml
@@ -74,13 +74,6 @@ jobs:
LOAD_PLUGINS: 1
steps:
- - name: Enable jemalloc
- run: echo /usr/lib/libjemalloc.so.1 > /etc/ld.so.preload
-
- - name: Verify jemalloc is loaded into Ruby
- run: |
- ruby -e 'abort "jemalloc not loaded" unless File.read("/proc/self/maps").include?("libjemalloc")'
-
- name: Set working directory owner
run: chown root:root .
@@ -94,8 +87,7 @@ jobs:
git config --global user.name "Discourse CI"
- name: Start redis
- run: |
- redis-server /etc/redis/redis.conf &
+ run: redis-server /etc/redis/redis.conf --daemonize yes --logfile ""
- name: Start Postgres
run: |
@@ -133,6 +125,7 @@ jobs:
- name: RSpec (Rails integration)
env:
+ LD_PRELOAD: /usr/lib/libjemalloc.so.1
MIGRATIONS_RAILS: "1"
run: |
for gem in core tooling converters importer; do
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 76a8c3a10a1..1d01891dc06 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -89,13 +89,6 @@ jobs:
build_type: system
steps:
- - name: Enable jemalloc
- run: echo /usr/lib/libjemalloc.so.1 > /etc/ld.so.preload
-
- - name: Verify jemalloc is loaded into Ruby
- run: |
- ruby -e 'abort "jemalloc not loaded" unless File.read("/proc/self/maps").include?("libjemalloc")'
-
- name: Set working directory owner
run: chown root:root .
@@ -123,7 +116,7 @@ jobs:
git config --global user.name "Discourse CI"
- name: Start redis
- run: redis-server /etc/redis/redis.conf &
+ run: redis-server /etc/redis/redis.conf --daemonize yes --logfile ""
- name: Start Postgres
run: |
@@ -263,6 +256,8 @@ jobs:
- name: Core RSpec
if: matrix.build_type == 'backend' && matrix.target == 'core'
+ env:
+ LD_PRELOAD: /usr/lib/libjemalloc.so.1
run: bin/turbo_rspec --use-runtime-info --format=progress
- name: Ember Build
@@ -288,6 +283,8 @@ jobs:
- name: Plugins RSpec
if: matrix.build_type == 'backend' && matrix.target == 'plugins'
+ env:
+ LD_PRELOAD: /usr/lib/libjemalloc.so.1
run: |
bin/rake plugin:turbo_spec['*','--format=progress --use-runtime-info']
@@ -308,12 +305,14 @@ jobs:
- name: Core System Tests
if: matrix.build_type == 'system' && matrix.target == 'core'
env:
+ LD_PRELOAD: /usr/lib/libjemalloc.so.1
CHECKOUT_TIMEOUT: 10
run: RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error bin/turbo_rspec --use-runtime-info --format documentation spec/system
- name: Core Plugins System Tests
if: matrix.build_type == 'system' && matrix.target == 'core-plugins'
env:
+ LD_PRELOAD: /usr/lib/libjemalloc.so.1
CHECKOUT_TIMEOUT: 10
run: |
RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error bin/turbo_rspec --exclude-pattern="plugins/chat/*" --use-runtime-info --format documentation plugins/*/spec/system
@@ -321,6 +320,7 @@ jobs:
- name: Official Plugins System Tests
if: matrix.build_type == 'system' && matrix.target == 'official-plugins'
env:
+ LD_PRELOAD: /usr/lib/libjemalloc.so.1
CHECKOUT_TIMEOUT: 10
run: |
RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error bin/turbo_rspec --exclude-pattern="$(script/list_bundled_plugins '/*' | paste -sd, -)" --use-runtime-info --format documentation plugins/*/spec/system
@@ -328,12 +328,14 @@ jobs:
- name: Chat System Tests
if: matrix.build_type == 'system' && matrix.target == 'chat'
env:
+ LD_PRELOAD: /usr/lib/libjemalloc.so.1
CHECKOUT_TIMEOUT: 10
run: RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error bin/turbo_rspec --use-runtime-info --format documentation plugins/chat/spec/system
- name: Theme System Tests
if: matrix.build_type == 'system' && matrix.target == 'themes'
env:
+ LD_PRELOAD: /usr/lib/libjemalloc.so.1
CHECKOUT_TIMEOUT: 10
run: RAILS_ENABLE_TEST_LOG=1 RAILS_TEST_LOG_LEVEL=error bin/turbo_rspec --format documentation tmp/themes/*/spec/system themes/*/spec/system
diff --git a/config/boot.rb b/config/boot.rb
index d14ab6341c4..5d0f2c5a8dd 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -35,7 +35,11 @@ if ENV["RAILS_ENV"] == "test" && ENV["TEST_ENV_NUMBER"]
`rm -rf tmp/test_data_#{n} && mkdir -p tmp/test_data_#{n}/redis`
pid =
- Process.spawn("redis-server --dir tmp/test_data_#{n}/redis --port #{port}", out: "/dev/null")
+ Process.spawn(
+ { "LD_PRELOAD" => nil },
+ "redis-server --dir tmp/test_data_#{n}/redis --port #{port}",
+ out: "/dev/null",
+ )
ENV["DISCOURSE_REDIS_PORT"] = port.to_s
ENV["RAILS_DB"] = "discourse_test_#{n}"