Skip to content

Commit 8a4aafd

Browse files
committed
Registry consistency tests: For every version, check that each compat entry has a corresponding deps entry
1 parent 64d788e commit 8a4aafd

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/registry_testing.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ function test(path=pwd(); registry_deps::Vector{<:AbstractString}=String[])
206206
# Compat.toml testing
207207
compatfile = abspath(data["path"], "Compat.toml")
208208
if isfile(compatfile)
209+
# If Compat.toml exists, Deps.toml must exist.
210+
Test.@test isfile(depsfile)
211+
209212
compat = Pkg.TOML.parsefile(compatfile)
210213
# Test that all names with compat is a dependency
211214
compatnames = Set{String}(x for (_, d) in compat for (x, _) in d)
@@ -238,6 +241,22 @@ function test(path=pwd(); registry_deps::Vector{<:AbstractString}=String[])
238241
else
239242
@debug "Compat.toml file does not exist" compatfile
240243
end
244+
245+
# https://github.com/JuliaRegistries/RegistryCI.jl/issues/522
246+
# For every version, each compat entry has a corresponding deps entry.
247+
if isfile(compatfile)
248+
compat_uncompressed = RegistryTools.Compress.load(compatfile)
249+
deps_uncompressed = isfile(depsfile) ? RegistryTools.Compress.load(depsfile) : Dict()
250+
for v in keys(vers)
251+
compat_for_this_v = get(compat_uncompressed, v, Dict())
252+
deps_for_this_v = get(deps_uncompressed, v, Dict())
253+
Test.@test compat_for_this_v isa AbstractDict
254+
Test.@test deps_for_this_v isa AbstractDict
255+
for compat_pkgname in keys(compat_for_this_v)
256+
@test haskey(deps_for_this_v, compat_pkgname)
257+
end
258+
end
259+
end
241260
end
242261
# Make sure all paths are unique
243262
path_parts = [splitpath(data["path"]) for (_, data) in reg["packages"]]

0 commit comments

Comments
 (0)