From 7eb388470ac03977c54789853747b9c8409a0b55 Mon Sep 17 00:00:00 2001 From: Tim Besard Date: Mon, 19 Apr 2021 12:09:06 +0200 Subject: [PATCH] Add a test-specific Project.toml to work around Pkg issue. --- Project.toml | 1 - test/Project.toml | 8 ++++++++ test/Sandbox.jl | 2 +- test/SandboxConfig.jl | 6 +++--- 4 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 test/Project.toml diff --git a/Project.toml b/Project.toml index 9c2f2cc..db065a5 100644 --- a/Project.toml +++ b/Project.toml @@ -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] diff --git a/test/Project.toml b/test/Project.toml new file mode 100644 index 0000000..851c3fb --- /dev/null +++ b/test/Project.toml @@ -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" diff --git a/test/Sandbox.jl b/test/Sandbox.jl index 2661af4..4a1800c 100644 --- a/test/Sandbox.jl +++ b/test/Sandbox.jl @@ -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") diff --git a/test/SandboxConfig.jl b/test/SandboxConfig.jl index 4cf00d2..fd84393 100644 --- a/test/SandboxConfig.jl +++ b/test/SandboxConfig.jl @@ -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) @@ -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 \ No newline at end of file +end