|
33 | 33 |
|
34 | 34 | cached_files = Dir.glob(default_bundle_path("cache", "mygem-1.0-*.gem").to_s) |
35 | 35 | expect(cached_files.size).to eq(1), "expected exactly one cached gem file, found: #{cached_files}" |
36 | | - expect(cached_files.first).to match(/mygem-1\.0-[0-9a-f]{8}\.gem$/) |
| 36 | + expect(cached_files.first).to match(/mygem-1\.0-[0-9a-f]{8,64}\.gem$/) |
37 | 37 | expect(default_bundle_path("cache", "mygem-1.0-x86_64-linux.gem")).not_to exist |
| 38 | + expect(lockfile).to match(/^ mygem \(1\.0-[0-9a-f]{8,64}\) x86_64-linux$/) |
| 39 | + end |
| 40 | + end |
| 41 | + |
| 42 | + it "resolves a content-addressed binary from the local cache after a lockfile round-trip" do |
| 43 | + simulate_platform "x86_64-linux" do |
| 44 | + build_repo2 do |
| 45 | + build_gem "mygem", "1.0" do |s| |
| 46 | + s.platform = Gem::Platform.new("x86_64-linux") |
| 47 | + s.write "lib/mygem.rb", "MYGEM = '1.0 not_content_addressed'" |
| 48 | + end |
| 49 | + end |
| 50 | + |
| 51 | + build_gem "mygem", "1.0", ruby_abi: current_abi, path: gem_repo2("gems") do |s| |
| 52 | + s.platform = Gem::Platform.new("x86_64-linux") |
| 53 | + s.required_ruby_version = "~> #{current_abi}.0" |
| 54 | + s.write "lib/mygem.rb", "MYGEM = '1.0 content_addressed'" |
| 55 | + end |
| 56 | + |
| 57 | + install_gemfile <<~G, artifice: "compact_index_v2", env: { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s } |
| 58 | + source "https://gem.repo2" |
| 59 | +
|
| 60 | + gem "mygem" |
| 61 | + G |
| 62 | + |
| 63 | + cached_file = Dir[default_bundle_path("cache", "mygem-1.0-*.gem").to_s].first |
| 64 | + FileUtils.mkdir_p(bundled_app("vendor/cache")) |
| 65 | + FileUtils.cp(cached_file, bundled_app("vendor/cache")) |
| 66 | + |
| 67 | + gem_dir = Dir[default_bundle_path("gems", "mygem-1.0-*").to_s].first |
| 68 | + pristine_system_gems |
| 69 | + bundle "install --local" |
| 70 | + |
| 71 | + expect(the_bundle).to include_gems "mygem 1.0 content_addressed" |
| 72 | + expect(Dir[default_bundle_path("gems", "mygem-1.0-*").to_s].first).to eq(gem_dir) |
38 | 73 | end |
39 | 74 | end |
40 | 75 |
|
|
0 commit comments