Skip to content

Commit

Permalink
fix(deployer): keep Cargo.lock between deployments (#517)
Browse files Browse the repository at this point in the history
  • Loading branch information
Procrat authored Dec 14, 2022
1 parent a7e7ed6 commit 24657bc
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion deployer/src/deployment/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ async fn extract_tar_gz_data(data: impl Read, dest: impl AsRef<Path>) -> Result<
let mut entries = fs::read_dir(&dest).await?;
while let Some(entry) = entries.next_entry().await? {
// Ignore the build cache directory
if entry.file_name() == "target" {
if ["target", "Cargo.lock"].contains(&entry.file_name().to_string_lossy().as_ref()) {
continue;
}

Expand Down Expand Up @@ -433,6 +433,11 @@ mod tests {
.await
.unwrap();

// Cargo.lock file shouldn't be deleted
fs::write(p.join("Cargo.lock"), "lock file contents shouldn't matter")
.await
.unwrap();

// Binary data for an archive in the following form:
//
// - temp
Expand Down Expand Up @@ -485,6 +490,12 @@ ff0e55bda1ff01000000000000000000e0079c01ff12a55500280000",
"build cache file should not be touched"
);

assert_eq!(
fs::read_to_string(p.join("Cargo.lock")).await.unwrap(),
"lock file contents shouldn't matter",
"Cargo lock file should not be touched"
);

// Can we extract again without error?
super::extract_tar_gz_data(test_data.as_slice(), &p)
.await
Expand Down

0 comments on commit 24657bc

Please sign in to comment.