Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: try removing one test #185

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 0 additions & 66 deletions axoupdater-cli/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,69 +369,3 @@ fn test_downgrade_to_specific_old_version() -> std::io::Result<()> {

Ok(())
}

// Similar to `test_upgrade` but tests releases created after the
// cargo-dist receipt prefix bug was fixed; see:
// https://github.com/axodotdev/cargo-dist/pull/1037
#[test]
fn test_upgrade_from_prefix_with_no_bin() -> std::io::Result<()> {
let tempdir = TempDir::new()?;
let prefix = Utf8PathBuf::from_path_buf(tempdir.path().to_path_buf()).unwrap();
let bindir_path = &tempdir.path().join("bin");
let bindir = Utf8Path::from_path(bindir_path).unwrap();
std::fs::create_dir_all(bindir)?;

// The first cargodisttest release with the "/bin" bug fixed
let base_version = "0.2.133";

let url = axolotlsay_tarball_path(base_version);
let compressed_path =
Utf8PathBuf::from_path_buf(tempdir.path().join("axolotlsay.tar.gz")).unwrap();

let client = axoasset::AxoClient::with_reqwest(axoasset::reqwest::Client::new());
let rt = tokio::runtime::Runtime::new().unwrap();
rt.block_on(client.load_and_write_to_file(&url, &compressed_path))
.unwrap();

// Write the receipt for the updater to use
// 0.15.0 is the first cargo-dist that published fixed installers for the
// /bin bug mentioned above
write_receipt(base_version, "0.15.0", &prefix)?;

LocalAsset::untar_gz_all(&compressed_path, bindir).unwrap();

// Now install our copy of the updater instead of the one axolotlsay came with
let updater_path = bindir.join(format!("axolotlsay-update{EXE_SUFFIX}"));
std::fs::copy(BIN, &updater_path)?;

let mut updater = Cmd::new(&updater_path, "run updater");
updater.env("AXOUPDATER_CONFIG_PATH", prefix);
// If we're not running in CI, try to avoid ruining the user's PATH.
if std::env::var("CI").is_err() {
updater.env("INSTALLER_NO_MODIFY_PATH", "1");
updater.env("AXOLOTLSAY_NO_MODIFY_PATH", "1");
}
// We'll do that manually
updater.check(false);
let res = updater.output().unwrap();

let output_stdout = String::from_utf8(res.stdout).unwrap();
let output_stderr = String::from_utf8(res.stderr).unwrap();

// Now let's check the version we just updated to
let new_axolotlsay_path = &bindir.join(format!("axolotlsay{EXE_SUFFIX}"));
assert!(
new_axolotlsay_path.exists(),
"update result was\nstdout\n{}\nstderr\n{}",
output_stdout,
output_stderr
);
let mut new_axolotlsay = Cmd::new(new_axolotlsay_path, "version test");
new_axolotlsay.arg("--version");
let output = new_axolotlsay.output().unwrap();
let stderr_string = String::from_utf8(output.stdout).unwrap();
assert!(stderr_string.starts_with("axolotlsay "));
assert_ne!(stderr_string, format!("axolotlsay {}\n", base_version));

Ok(())
}
Loading