Skip to content

Commit

Permalink
test: add oci_tarball test for sh_test
Browse files Browse the repository at this point in the history
  • Loading branch information
thesayyn committed Jun 12, 2024
1 parent 09d5521 commit ab6499a
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion examples/assertion/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ assert_json_matches(
filter1 = ".[0].RepoTags",
)

# Case 10: An oci_image directly fed into oci_tarball
# Case 10: an oci_tarball run as part of a genrule
oci_image(
name = "case10",
architecture = "arm64",
Expand All @@ -312,6 +312,38 @@ $(location :case10_tarball) && echo "worked" > $@
tools = [":case10_tarball"],
)

# Case 11: an oci_tarball run as part of sh_test
oci_image(
name = "case11",
architecture = "arm64",
os = "linux",
)

oci_tarball(
name = "case11_tarball",
image = ":case11",
repo_tags = ["case11:example"],
)

write_file(
name = "case11_test_sh",
out = "case11_test.sh",
content = [
"output=$($1)",
'if [[ "$output" != "Loaded image: case11:example" ]]; then',
' echo "failed to load: $output"',
" exit 1",
"fi",
],
)

sh_test(
name = "case11_test",
srcs = ["case11_test.sh"],
args = ["$(location :case11_tarball)"],
data = [":case11_tarball"],
)

# build them as test.
build_test(
name = "test",
Expand Down

0 comments on commit ab6499a

Please sign in to comment.