Skip to content

Commit

Permalink
Add a test-specific Project.toml to work around Pkg issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt committed Apr 19, 2021
1 parent b779322 commit 9cfbd37
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
1 change: 0 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Preferences = "21216c6a-2e73-6563-6e65-726566657250"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Scratch = "6c6a2e73-6563-6170-7368-637461726353"
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
UserNSSandbox_jll = "b88861f7-1d72-59dd-91e7-a8cc876a4984"

[compat]
Expand Down
8 changes: 8 additions & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# A bug in Julia 1.6.0's Pkg causes Preferences to be dropped during `Pkg.test()`, so we work around
# it by explicitly creating a `test/Project.toml` which will correctly communicate any preferences
# through to the child Julia process. X-ref: https://github.com/JuliaLang/Pkg.jl/issues/2500

[deps]
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
Scratch = "6c6a2e73-6563-6170-7368-637461726353"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2 changes: 1 addition & 1 deletion test/Sandbox.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if !success(`sudo -k -n true`)
all_executors = filter(exe -> exe != PrivilegedUserNamespacesExecutor, all_executors)
end

rootfs_dir = artifact"AlpineRootfs"
rootfs_dir = Sandbox.alpine_rootfs()
for executor in all_executors
if !executor_available(executor)
@error("Skipping $(executor) tests, as it does not seem to be available")
Expand Down
6 changes: 3 additions & 3 deletions test/SandboxConfig.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using Test, Artifacts

@testset "SandboxConfig" begin
rootfs_dir = artifact"AlpineRootfs"
rootfs_dir = Sandbox.alpine_rootfs()

@testset "minimal config" begin
config = SandboxConfig(Dict("/" => rootfs_dir))

@test haskey(config.read_only_maps, "/")
@test config.read_only_maps["/"] == rootfs_dir
@test isempty(config.read_write_maps)
Expand Down Expand Up @@ -59,4 +59,4 @@ using Test, Artifacts
@test_throws ArgumentError SandboxConfig(Dict("/" => rootfs_dir); pwd="lib")
@test_throws ArgumentError SandboxConfig(Dict("/" => rootfs_dir); entrypoint="init")
end
end
end

0 comments on commit 9cfbd37

Please sign in to comment.