Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RAI-15505] Configurable default values #77

Merged
merged 7 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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_ALLOWED", "warning"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allowed is a little vague here - maybe SEVERITY_ALLOWED ?

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