Skip to content

Commit fb59ed3

Browse files
authored
Merge pull request #13 from timflannagan/ci/add-basic-bundle-test
Add basic scratch-based container image tests
2 parents 13e5748 + 421d33c commit fb59ed3

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/cli.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const PRG: &str = "dcp";
88
const TEST_CONTENT_DIR: &str = "/tmp/dcp_test_run";
99
const DEFAULT_IMAGE: &str = "quay.io/tyslaton/sample-catalog:v0.0.4";
1010
const IMAGE_NO_TAG: &str = "quay.io/tyslaton/sample-catalog";
11+
const SCRATCH_BASE_IMAGE: &str = "quay.io/tflannag/bundles:resolveset-v0.0.2";
1112

1213
// generate_temp_path takes the constant TEST_CONTENT_DIR and
1314
// returns a new string with an appended 5 digit string
@@ -71,6 +72,24 @@ fn accepts_content_path() -> TestResult {
7172
Ok(())
7273
}
7374

75+
// --------------------------------------------------
76+
#[test]
77+
fn fails_invalid_content_path() -> TestResult {
78+
let path = &generate_temp_path();
79+
let content_path = "manifests";
80+
81+
// --content-path has been specified but fails as
82+
// there's no "manifests" directory in the
83+
// DEFAULT_IMAGE container image.
84+
Command::cargo_bin(PRG)?
85+
.args(&["--download-path", path])
86+
.args(&["--content-path", content_path, DEFAULT_IMAGE])
87+
.assert()
88+
.failure();
89+
90+
Ok(())
91+
}
92+
7493
// --------------------------------------------------
7594
#[test]
7695
fn accepts_image() -> TestResult {
@@ -121,3 +140,17 @@ fn fails_on_just_tag() -> TestResult {
121140

122141
Ok(())
123142
}
143+
144+
// --------------------------------------------------
145+
#[test]
146+
fn accepts_scratch_base_images() -> TestResult {
147+
let content_path: &str = "manifests";
148+
149+
Command::cargo_bin(PRG)?
150+
.args(&["--content-path", content_path])
151+
.args(&[SCRATCH_BASE_IMAGE])
152+
.assert()
153+
.success();
154+
155+
Ok(())
156+
}

0 commit comments

Comments
 (0)