Skip to content

Commit

Permalink
Integration test for metadata migration
Browse files Browse the repository at this point in the history
  • Loading branch information
schneems committed May 14, 2024
1 parent ebf1c72 commit f099a13
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
2 changes: 1 addition & 1 deletion buildpacks/ruby/src/layers/bundle_install_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ impl Layer for BundleInstallLayer<'_> {

match cache_state(old.clone(), now) {
Changed::Nothing => {
log_step("Loading cache");
log_step("Loading cached gems");

keep_and_run
}
Expand Down
2 changes: 1 addition & 1 deletion buildpacks/ruby/src/layers/ruby_install_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ impl<'a> Layer for RubyInstallLayer<'a> {

match cache_state(old.clone(), now) {
Changed::Nothing => {
log_step("Using cached version");
log_step("Using cached Ruby version");

Ok(ExistingLayerStrategy::Keep)
}
Expand Down
2 changes: 1 addition & 1 deletion buildpacks/ruby/src/target_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ pub(crate) struct TargetId {
}

const DISTRO_VERSION_STACK: &[(&str, &str, &str)] = &[
("ubuntu", "20.04", "heroku-20"),
("ubuntu", "22.04", "heroku-22"),
("ubuntu", "24.04", "heroku-24"),
];

#[derive(Debug, thiserror::Error)]
Expand Down
28 changes: 28 additions & 0 deletions buildpacks/ruby/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,34 @@ use std::thread;
use std::time::{Duration, Instant};
use ureq::Response;

// Test that:
// - Cached data "stack" is preserved and will be successfully migrated to "targets"
#[test]
#[ignore = "integration test"]
fn test_migrating_metadata() {
let builder = "heroku/builder:22";
let app_dir = "tests/fixtures/default_ruby";

TestRunner::default().build(
BuildConfig::new(builder, app_dir).buildpacks([BuildpackReference::Other(
"docker://docker.io/heroku/buildpack-ruby:2.1.2".to_string(),
)]),
|context| {
println!("{}", context.pack_stdout);
context.rebuild(
BuildConfig::new(builder, app_dir).buildpacks([BuildpackReference::CurrentCrate]),
|rebuild_context| {
println!("{}", rebuild_context.pack_stdout); // Needed to get full failure as `rebuild` truncates stdout

assert_contains!(rebuild_context.pack_stdout, "Using cached Ruby version");
assert_contains!(rebuild_context.pack_stdout, "Loading cached gems");
panic!("disco");
},
);
},
);
}

#[test]
#[ignore = "integration test"]
fn test_default_app() {
Expand Down

0 comments on commit f099a13

Please sign in to comment.