chore: Remove need to update .gitignore by making use of temporary directories

This commit is contained in:
Gerald Pinder 2024-11-06 23:58:28 -05:00
parent 5ff001816c
commit 752c957914
11 changed files with 61 additions and 202 deletions

View file

@ -174,7 +174,7 @@ mod test {
use std::{fs, path::Path};
use blue_build_utils::constants::{COSIGN_PRIV_PATH, COSIGN_PUB_PATH};
use tempdir::TempDir;
use tempfile::TempDir;
use crate::drivers::{
opts::{CheckKeyPairOpts, GenerateKeyPairOpts},
@ -185,7 +185,7 @@ mod test {
#[test]
fn generate_key_pair() {
let tempdir = TempDir::new("keypair").unwrap();
let tempdir = TempDir::new().unwrap();
let gen_opts = GenerateKeyPairOpts::builder().dir(tempdir.path()).build();
@ -219,7 +219,7 @@ mod test {
fn compatibility() {
use crate::drivers::sigstore_driver::SigstoreDriver;
let tempdir = TempDir::new("keypair").unwrap();
let tempdir = TempDir::new().unwrap();
let gen_opts = GenerateKeyPairOpts::builder().dir(tempdir.path()).build();

View file

@ -18,7 +18,7 @@ use miette::{bail, IntoDiagnostic, Result};
use once_cell::sync::Lazy;
use semver::Version;
use serde::Deserialize;
use tempdir::TempDir;
use tempfile::TempDir;
use crate::{
drivers::{
@ -388,7 +388,7 @@ impl InspectDriver for DockerDriver {
impl RunDriver for DockerDriver {
fn run(opts: &RunOpts) -> std::io::Result<ExitStatus> {
let cid_path = TempDir::new("docker")?;
let cid_path = TempDir::new()?;
let cid_file = cid_path.path().join("cid");
let cid = ContainerId::new(&cid_file, ContainerRuntime::Docker, false);
@ -403,7 +403,7 @@ impl RunDriver for DockerDriver {
}
fn run_output(opts: &RunOpts) -> std::io::Result<std::process::Output> {
let cid_path = TempDir::new("docker")?;
let cid_path = TempDir::new()?;
let cid_file = cid_path.path().join("cid");
let cid = ContainerId::new(&cid_file, ContainerRuntime::Docker, false);

View file

@ -14,7 +14,7 @@ use miette::{bail, miette, IntoDiagnostic, Report, Result};
use oci_distribution::Reference;
use semver::Version;
use serde::Deserialize;
use tempdir::TempDir;
use tempfile::TempDir;
use crate::{
drivers::{
@ -310,7 +310,7 @@ impl RunDriver for PodmanDriver {
fn run(opts: &RunOpts) -> std::io::Result<ExitStatus> {
trace!("PodmanDriver::run({opts:#?})");
let cid_path = TempDir::new("podman")?;
let cid_path = TempDir::new()?;
let cid_file = cid_path.path().join("cid");
let cid = ContainerId::new(&cid_file, ContainerRuntime::Podman, opts.privileged);
@ -332,7 +332,7 @@ impl RunDriver for PodmanDriver {
fn run_output(opts: &RunOpts) -> std::io::Result<std::process::Output> {
trace!("PodmanDriver::run_output({opts:#?})");
let cid_path = TempDir::new("podman")?;
let cid_path = TempDir::new()?;
let cid_file = cid_path.path().join("cid");
let cid = ContainerId::new(&cid_file, ContainerRuntime::Podman, opts.privileged);

View file

@ -235,7 +235,7 @@ mod test {
use std::{fs, path::Path};
use blue_build_utils::constants::{COSIGN_PRIV_PATH, COSIGN_PUB_PATH};
use tempdir::TempDir;
use tempfile::TempDir;
use crate::drivers::{
cosign_driver::CosignDriver,
@ -247,7 +247,7 @@ mod test {
#[test]
fn generate_key_pair() {
let tempdir = TempDir::new("keypair").unwrap();
let tempdir = TempDir::new().unwrap();
let gen_opts = GenerateKeyPairOpts::builder().dir(tempdir.path()).build();
@ -278,7 +278,7 @@ mod test {
#[test]
fn compatibility() {
let tempdir = TempDir::new("keypair").unwrap();
let tempdir = TempDir::new().unwrap();
let gen_opts = GenerateKeyPairOpts::builder().dir(tempdir.path()).build();