Skip to content

Commit

Permalink
Introduce kct_testing to help render packages
Browse files Browse the repository at this point in the history
  • Loading branch information
bruno-delfino1995 committed Jul 1, 2022
1 parent 9e54dc2 commit 3ae2354
Show file tree
Hide file tree
Showing 28 changed files with 212 additions and 160 deletions.
15 changes: 13 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
members = [
"bin",
"crates/kct_helper",
"crates/kct_testing",
"crates/kct_kube",
"crates/kct_package"
]
2 changes: 1 addition & 1 deletion bin/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub fn run(args: Args) -> Result<String, Box<dyn Error>> {

let output = ensure_output_exists(&args.output)?;

let package = Package::try_from(args.package)?;
let package = Package::try_from(args.package.as_path())?;

let release = args.release.map(|name| Release { name });

Expand Down
2 changes: 1 addition & 1 deletion bin/src/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub struct Args {
}

pub fn run(args: Args) -> Result<String, Box<dyn Error>> {
let package = Package::try_from(args.package)?;
let package = Package::try_from(args.package.as_path())?;

let cwd = std::env::current_dir()?;
let compressed_path = package.archive(&cwd)?;
Expand Down
3 changes: 1 addition & 2 deletions crates/kct_package/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ url = "2.1.1"
valico = "3.4.0"

[dev-dependencies]
fs_extra = "1.2.0"
tempfile = "3.1.0"
kct_testing = { path = "../kct_testing", version = "^0.4.0"}
2 changes: 1 addition & 1 deletion crates/kct_package/src/functions/include.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl Property for Include {
};

let root = vendor.join(&package);
let package = Package::try_from(root).map_err(|err| err.to_string())?;
let package = Package::try_from(root.as_path()).map_err(|err| err.to_string())?;

let input: Option<Value> = params.get("input").cloned();

Expand Down
6 changes: 4 additions & 2 deletions crates/kct_package/src/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ pub struct Package {
pub example: Option<Value>,
}

impl TryFrom<PathBuf> for Package {
impl TryFrom<&Path> for Package {
type Error = Error;

fn try_from(root: PathBuf) -> Result<Self> {
fn try_from(root: &Path) -> Result<Self> {
let root = PathBuf::from(root);

let spec = {
let mut path = root.clone();
path.push(SPEC_FILE);
Expand Down

This file was deleted.

77 changes: 0 additions & 77 deletions crates/kct_package/tests/helpers/fixture.rs

This file was deleted.

30 changes: 0 additions & 30 deletions crates/kct_package/tests/helpers/mod.rs

This file was deleted.

1 change: 1 addition & 0 deletions crates/kct_package/tests/kcp
Loading

0 comments on commit 3ae2354

Please sign in to comment.