Skip to content

Commit

Permalink
[RAI-15505] Configurable default values (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmcgr authored Aug 28, 2023
1 parent 6105e57 commit f3d014b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
5 changes: 5 additions & 0 deletions src/code-util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
3 changes: 2 additions & 1 deletion src/testpool.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

"""
Expand Down
12 changes: 6 additions & 6 deletions src/testrel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit f3d014b

Please sign in to comment.