Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 109fae4

Browse files
committedMar 19, 2025·
Update test
The purpose of this test is to validate that metadata stays valid between versions. However the Ruby version change between default version bumps was causing a cache invalidation. This test is made more robust by specifying an explicit Ruby version
1 parent 140e2d6 commit 109fae4

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed
 

‎buildpacks/ruby/tests/integration_test.rs

+28-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use libcnb_test::{
1010
};
1111
use pretty_assertions::assert_eq;
1212
use regex::Regex;
13+
use std::io::Write;
1314
use std::os::unix::fs::PermissionsExt;
1415
use std::path::{Path, PathBuf};
1516
use std::thread;
@@ -24,14 +25,38 @@ fn test_migrating_metadata_or_layer_names() {
2425
// This test is a placeholder for when a change modifies metadata structures.
2526
// Remove the return and update the `buildpack-ruby` reference to the latest version.
2627
#![allow(unreachable_code)]
27-
// Test v5.0.1 compatible with v5.0.0
28+
// Test v7.0.0 compatible with v6.0.0
2829

2930
let builder = "heroku/builder:24";
30-
let app_dir = "tests/fixtures/default_ruby";
31+
let temp = tempfile::tempdir().unwrap();
32+
let app_dir = temp.path();
33+
34+
copy_dir_all(
35+
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
36+
.join("tests")
37+
.join("fixtures")
38+
.join("default_ruby"),
39+
app_dir,
40+
)
41+
.unwrap();
42+
43+
// Specify explicit versions so changes in default values don't cause this test to fail
44+
writeln!(
45+
fs_err::OpenOptions::new()
46+
.write(true)
47+
.append(true)
48+
.open(app_dir.join("Gemfile.lock"))
49+
.unwrap(),
50+
indoc! {"
51+
RUBY VERSION
52+
ruby 3.4.2
53+
"}
54+
)
55+
.unwrap();
3156

3257
TestRunner::default().build(
3358
BuildConfig::new(builder, app_dir).buildpacks([BuildpackReference::Other(
34-
"docker://docker.io/heroku/buildpack-ruby:5.0.0".to_string(),
59+
"docker://docker.io/heroku/buildpack-ruby:6.0.0".to_string(),
3560
)]),
3661
|context| {
3762
println!("{}", context.pack_stderr);

0 commit comments

Comments
 (0)
Please sign in to comment.