Skip to content

Commit

Permalink
test that entries in default config have "help" and "value"
Browse files Browse the repository at this point in the history
  • Loading branch information
haakon-e committed Nov 21, 2024
1 parent fd0dbb6 commit cc8433e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/config.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ using Test
import ClimaComms
ClimaComms.@import_required_backends
import ClimaAtmos as CA
import YAML

include(joinpath("..", "perf", "common.jl"))

Expand Down Expand Up @@ -37,3 +38,18 @@ repeated_job_ids = filter(kv -> length(kv[2]) > 1, value_to_keys)
file, io = mktemp()
config_err = ErrorException("File $(CA.normrelpath(file)) is empty or missing.")
@test_throws config_err CA.AtmosConfig(file)

@testset "Check that entries in `default_config.yml` have `help` and `value` keys" begin
default_config_file = joinpath("..", "config", "default_configs", "default_config.yml")
config = YAML.load_file(default_config_file)
missing_help = String[]
missing_value = String[]
for (key, value) in config
!haskey(value, "help") && push!(missing_help, key)
!haskey(value, "value") && push!(missing_value, key)
end
# Every key in the default config should have a `help` and `value` key
# If not, these tests will fail, indicating which keys are missing
@test isempty(missing_help)
@test isempty(missing_value)
end

0 comments on commit cc8433e

Please sign in to comment.