From f3d014b401ffdb75bf03d5f069286b7c0e06bc32 Mon Sep 17 00:00:00 2001 From: Martin McGrane Date: Mon, 28 Aug 2023 12:49:15 +1000 Subject: [PATCH] [RAI-15505] Configurable default values (#77) --- src/code-util.jl | 5 +++++ src/testpool.jl | 3 ++- src/testrel.jl | 12 ++++++------ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/code-util.jl b/src/code-util.jl index b6fac21..ae22ba4 100644 --- a/src/code-util.jl +++ b/src/code-util.jl @@ -345,3 +345,8 @@ function get_logging_io() ctx = IOContext(io, stream) return io, ctx end + +default_timeout() = parse(Int64, get(ENV, "TEST_REL_TEST_TIMEOUT", "300")) +default_allowed() = Symbol(get(ENV, "TEST_REL_SEVERITY_ALLOWED", "warning")) +default_db_name() = get(ENV, "TEST_REL_DB_NAME", "test_rel") +default_engine_name() = get(ENV, "TEST_REL_ENGINE_NAME", "test_rel") diff --git a/src/testpool.jl b/src/testpool.jl index cf21b93..24575da 100644 --- a/src/testpool.jl +++ b/src/testpool.jl @@ -132,7 +132,8 @@ function delete_test_engine!(name::String) end function get_next_engine_name(id::Int64) - return "julia-sdk-test-$(id)" + base_name = default_engine_name() + return "$(base_name)-$(id)" end """ diff --git a/src/testrel.jl b/src/testrel.jl index 5980441..bf6519e 100644 --- a/src/testrel.jl +++ b/src/testrel.jl @@ -39,8 +39,8 @@ function set_context!(new_context::Context) return TEST_CONTEXT[] = new_context end -function create_test_database_name(; default_basename="test_rel")::String - basename = get(ENV, "TEST_REL_DB_BASENAME", default_basename) +function create_test_database_name()::String + basename = default_db_name() return gen_safe_name(basename) end @@ -163,9 +163,9 @@ function Step(; inputs::AbstractDict=Dict(), expected::AbstractDict=Dict(), expected_problems::Vector=[], - allow_unexpected::Symbol=:warning, + allow_unexpected::Symbol=default_allowed(), expect_abort::Bool=false, - timeout_sec::Int64=300, + timeout_sec::Int64=default_timeout(), readonly::Bool=false, ) return Step( @@ -265,9 +265,9 @@ function test_rel(; inputs::AbstractDict=Dict(), expected::AbstractDict=Dict(), expected_problems::Vector=[], - allow_unexpected::Symbol=:warning, + allow_unexpected::Symbol=default_allowed(), expect_abort::Bool=false, - timeout_sec::Int64=300, + timeout_sec::Int64=default_timeout(), broken::Bool=false, clone_db::Option{String}=nothing, engine::Option{String}=nothing,