Skip to content

Commit 955fdc7

Browse files
author
Doug Edey
committed
Test Redis TTL parsing
1 parent 405c557 commit 955fdc7

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

ruby/lib/ci/queue/configuration.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def from_env(env)
1818
seed: env['CIRCLE_SHA1'] || env['BUILDKITE_COMMIT'] || env['TRAVIS_COMMIT'] || env['HEROKU_TEST_RUN_COMMIT_VERSION'] || env['SEMAPHORE_GIT_SHA'],
1919
flaky_tests: load_flaky_tests(env['CI_QUEUE_FLAKY_TESTS']),
2020
statsd_endpoint: env['CI_QUEUE_STATSD_ADDR'],
21-
redis_ttl: env['CI_QUEUE_REDIS_TTL'],
21+
redis_ttl: env['CI_QUEUE_REDIS_TTL']&.to_i || 8 * 60 * 60,
2222
)
2323
end
2424

ruby/test/ci/queue/configuration_test.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,18 @@ def test_namespace
6565
assert_equal 'browser:9e08ef3c-d6e6-4a86-91dd-577ce5205b8e', config.build_id
6666
end
6767

68+
def test_redis_ttl_defaults
69+
config = Configuration.new
70+
assert_equal(28_800, config.redis_ttl)
71+
end
72+
73+
def test_redis_ttl_from_env
74+
config = Configuration.from_env(
75+
"CI_QUEUE_REDIS_TTL" => "14400"
76+
)
77+
assert_equal(14_400, config.redis_ttl)
78+
end
79+
6880
def test_parses_file_correctly
6981
Tempfile.open('flaky_test_file') do |file|
7082
file.write(SharedTestCases::TEST_NAMES.join("\n") + "\n")

0 commit comments

Comments
 (0)