Skip to content

Commit 2dae7e7

Browse files
authored
Registry consistency tests: For every version, check that each compat entry has a corresponding deps entry
1 parent 3082b39 commit 2dae7e7

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
@@ -201,6 +201,9 @@ function test(path=pwd(); registry_deps::Vector{<:AbstractString}=String[])
201201
# Compat.toml testing
202202
compatfile = abspath(data["path"], "Compat.toml")
203203
if isfile(compatfile)
204+
# If Compat.toml exists, Deps.toml must exist.
205+
Test.@test isfile(depsfile)
206+
204207
compat = Pkg.TOML.parsefile(compatfile)
205208
# Test that all names with compat is a dependency
206209
compatnames = Set{String}(x for (_, d) in compat for (x, _) in d)
@@ -233,6 +236,22 @@ function test(path=pwd(); registry_deps::Vector{<:AbstractString}=String[])
233236
else
234237
@debug "Compat.toml file does not exist" compatfile
235238
end
239+
240+
# https://github.com/JuliaRegistries/RegistryCI.jl/issues/522
241+
# For every version, each compat entry has a corresponding deps entry.
242+
if isfile(compatfile)
243+
compat_uncompressed = RegistryTools.Compress.load(compatfile)
244+
deps_uncompressed = isfile(depsfile) ? RegistryTools.Compress.load(depsfile) : Dict()
245+
for v in keys(vers)
246+
compat_for_this_v = get(compat_uncompressed, v, Dict())
247+
deps_for_this_v = get(deps_uncompressed, v, Dict())
248+
Test.@test compat_for_this_v isa AbstractDict
249+
Test.@test deps_for_this_v isa AbstractDict
250+
for compat_pkgname in keys(compat_for_this_v)
251+
@test haskey(deps_for_this_v, compat_pkgname)
252+
end
253+
end
254+
end
236255
end
237256
# Make sure all paths are unique
238257
path_parts = [splitpath(data["path"]) for (_, data) in reg["packages"]]

0 commit comments

Comments
 (0)