Skip to content

Commit

Permalink
test(gzip): add unit tests for gzip
Browse files Browse the repository at this point in the history
Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
  • Loading branch information
rchincha committed Nov 1, 2023
1 parent fb810cd commit bc3756a
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/gzip.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
load helpers

function setup() {
stacker_setup
}

function teardown() {
cleanup
}

@test "import tar" {
mkdir -p folder1
truncate -s 512k folder1/file1
tar cvf test.tar folder1
cat > stacker.yaml <<EOF
first:
from:
type: tar
url: test.tar
EOF
stacker build
m1=$(cat oci/index.json | jq .manifests[0].digest | sed 's/sha256://' | tr -d \")
l1=$(cat oci/blobs/sha256/"$m1" | jq .layers[0].digest | sed 's/sha256://' | tr -d \")
skopeo copy --format=oci oci:oci:first containers-storage:test:tar
skopeo copy --format=oci containers-storage:test:tar oci:oci:tar
m2=$(cat oci/index.json | jq .manifests[1].digest | sed 's/sha256://' | tr -d \")
l2=$(cat oci/blobs/sha256/"$m2" | jq .layers[0].digest | sed 's/sha256://' | tr -d \")
[ "$l1" == "$l2" ]
}

0 comments on commit bc3756a

Please sign in to comment.