From 886402fd851e5aff778f1bdb48dfa7849e334e8e Mon Sep 17 00:00:00 2001 From: Morten Piibeleht Date: Thu, 6 Jul 2023 20:14:27 +1200 Subject: [PATCH] test: fix permissions of PackageBundler test inputs (#11) --- test/jobs.jl | 12 ++++++++++-- test/packagebundler.jl | 10 +++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/test/jobs.jl b/test/jobs.jl index 31fad39c9..d65a9c547 100644 --- a/test/jobs.jl +++ b/test/jobs.jl @@ -1,5 +1,13 @@ +# We have to copy the test environment files to a temporary directory +# because PackageBundler needs write access to them. +JOBENVS = let tmp = tempname() + cp(joinpath(@__DIR__, "jobenvs"), tmp) + chmod(tmp, 0o777; recursive=true) + tmp +end + @testset "JuliaHub.script" begin - jobfile(path...) = joinpath(@__DIR__, "jobenvs", "job1", path...) + jobfile(path...) = joinpath(JOBENVS, "job1", path...) let s = JuliaHub.script(; code="1", project="name=1", manifest="name=1", artifacts="name=1") @test s.code == "1" @@ -50,7 +58,7 @@ end @testset "JuliaHub.appbundle" begin - jobfile(path...) = joinpath(@__DIR__, "jobenvs", "job1", path...) + jobfile(path...) = joinpath(JOBENVS, "job1", path...) bundle = JuliaHub.appbundle(jobfile(), "script.jl") @test isfile(bundle.environment.tarball_path) diff --git a/test/packagebundler.jl b/test/packagebundler.jl index 9c69844ad..7c525bc9a 100644 --- a/test/packagebundler.jl +++ b/test/packagebundler.jl @@ -1,6 +1,14 @@ import Tar -pkg1 = joinpath(@__DIR__, "fixtures", "ignorefiles", "Pkg1") +# We have to copy the test environment files to a temporary directory +# because PackageBundler needs write access to them. +TMP_FIXTURES = let tmp = tempname() + cp(joinpath(@__DIR__, "fixtures"), tmp) + chmod(tmp, 0o777; recursive=true) + tmp +end + +pkg1 = joinpath(TMP_FIXTURES, "ignorefiles", "Pkg1") if !isdir(joinpath(pkg1, ".git")) mkdir(joinpath(pkg1, ".git")) # can't check in sub-repos touch(joinpath(pkg1, ".git", "test"))