Skip to content

Commit 340e143

Browse files
committed
Clean go module cache after test
Workaround following error ``` 1) bundle gem gem naming with underscore --ext parameter set with go includes go_gem extension in extconf.rb Failure/Error: FileUtils.rm_r(dir) Errno::EACCES: Permission denied @ apply2files - /home/runner/work/rubygems/rubygems/bundler/tmp/2.2/home/go/pkg/mod/gopkg.in/[email protected]/decode_test.go # ./spec/support/helpers.rb:37:in `block in reset!' # ./spec/support/helpers.rb:21:in `each' # ./spec/support/helpers.rb:21:in `reset!' # ./spec/spec_helper.rb:130:in `block (2 levels) in <top (required)>' # /home/runner/work/rubygems/rubygems/lib/rubygems.rb:303:in `load' # /home/runner/work/rubygems/rubygems/lib/rubygems.rb:303:in `activate_and_load_bin_path' ``` Files installed with `go get` have permissions set to 444 ref. golang/go#35615 ``` $ ls -l /home/runner/work/rubygems/rubygems/bundler/tmp/2.2/home/go/pkg/mod/gopkg.in/[email protected]/decode_test.go -r--r--r-- 1 runner runner 42320 Nov 15 06:38 /home/runner/work/rubygems/rubygems/bundler/tmp/2.2/home/go/pkg/mod/gopkg.in/[email protected]/decode_test.go ``` So they cannot be deleted by `FileUtils.rm_r`. Therefore, this is necessary to execute `go clean -modcache` separately from `FileUtils.rm_r` to circumvent it.
1 parent 3d2cbcc commit 340e143

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

bundler/spec/commands/newgem_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1763,6 +1763,10 @@ def create_temporary_dir(dir)
17631763
bundle ["gem", gem_name, flags].compact.join(" ")
17641764
end
17651765

1766+
after do
1767+
sys_exec("go clean -modcache", raise_on_error: true) if installed_go?
1768+
end
1769+
17661770
it "is not deprecated" do
17671771
expect(err).not_to include "[DEPRECATED] Option `--ext` without explicit value is deprecated."
17681772
end

0 commit comments

Comments
 (0)