-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
- Loading branch information
Showing
3 changed files
with
165 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
load helpers | ||
|
||
function setup() { | ||
stacker_setup | ||
} | ||
|
||
function teardown() { | ||
cleanup | ||
} | ||
|
||
@test "import tar < 1M" { | ||
mkdir -p folder1 | ||
truncate -s 512k folder1/file1 | ||
tar cvf test.tar folder1 | ||
cat > stacker.yaml <<EOF | ||
tar: | ||
from: | ||
type: tar | ||
url: test.tar | ||
EOF | ||
stacker build | ||
cat oci/index.json | jq . | ||
m1=$(cat oci/index.json | jq .manifests[0].digest | sed 's/sha256://' | tr -d \") | ||
cat oci/blobs/sha256/"$m1" | jq . | ||
l1=$(cat oci/blobs/sha256/"$m1" | jq .layers[0].digest | sed 's/sha256://' | tr -d \") | ||
$SKOPEO --version | ||
[[ "$($SKOPEO --version)" =~ "skopeo version ${SKOPEO_VERSION}" ]] || { | ||
echo "$SKOPEO --version should be ${SKOPEO_VERSION}" | ||
exit 1 | ||
} | ||
$SKOPEO copy --format=oci oci:oci:tar containers-storage:test:tar | ||
$SKOPEO copy --format=oci containers-storage:test:tar oci:oci:test | ||
cat oci/index.json | jq . | ||
m2=$(cat oci/index.json | jq .manifests[1].digest | sed 's/sha256://' | tr -d \") | ||
cat oci/blobs/sha256/"$m2" | jq . | ||
l2=$(cat oci/blobs/sha256/"$m2" | jq .layers[0].digest | sed 's/sha256://' | tr -d \") | ||
echo "$l1" | ||
echo "$l2" | ||
[ "$l1" = "$l2" ] | ||
} | ||
|
||
@test "import tar > 1M" { | ||
mkdir -p folder1 | ||
truncate -s 2m folder1/file1 | ||
tar cvf test.tar folder1 | ||
cat > stacker.yaml <<EOF | ||
tar: | ||
from: | ||
type: tar | ||
url: test.tar | ||
EOF | ||
stacker build | ||
cat oci/index.json | jq . | ||
m1=$(cat oci/index.json | jq .manifests[0].digest | sed 's/sha256://' | tr -d \") | ||
cat oci/blobs/sha256/"$m1" | jq . | ||
l1=$(cat oci/blobs/sha256/"$m1" | jq .layers[0].digest | sed 's/sha256://' | tr -d \") | ||
[[ "$($SKOPEO --version)" =~ "skopeo version ${SKOPEO_VERSION}" ]] || { | ||
echo "$SKOPEO --version should be ${SKOPEO_VERSION}" | ||
exit 1 | ||
} | ||
$SKOPEO copy --format=oci oci:oci:tar containers-storage:test:tar | ||
$SKOPEO copy --format=oci containers-storage:test:tar oci:oci:test | ||
cat oci/index.json | jq . | ||
m2=$(cat oci/index.json | jq .manifests[1].digest | sed 's/sha256://' | tr -d \") | ||
cat oci/blobs/sha256/"$m2" | jq . | ||
l2=$(cat oci/blobs/sha256/"$m2" | jq .layers[0].digest | sed 's/sha256://' | tr -d \") | ||
echo "$l1" | ||
echo "$l2" | ||
[ "$l1" = "$l2" ] | ||
} | ||
|
||
@test "import tar.gz < 1M" { | ||
mkdir -p folder1 | ||
truncate -s 512k folder1/file1 | ||
tar cvzf test.tar.gz folder1 | ||
cat > stacker.yaml <<EOF | ||
tar: | ||
from: | ||
type: tar | ||
url: test.tar.gz | ||
EOF | ||
stacker build | ||
cat oci/index.json | jq . | ||
m1=$(cat oci/index.json | jq .manifests[0].digest | sed 's/sha256://' | tr -d \") | ||
cat oci/blobs/sha256/"$m1" | jq . | ||
l1=$(cat oci/blobs/sha256/"$m1" | jq .layers[0].digest | sed 's/sha256://' | tr -d \") | ||
[[ "$($SKOPEO --version)" =~ "skopeo version ${SKOPEO_VERSION}" ]] || { | ||
echo "$SKOPEO --version should be ${SKOPEO_VERSION}" | ||
exit 1 | ||
} | ||
$SKOPEO copy --format=oci oci:oci:tar containers-storage:test:tar | ||
$SKOPEO copy --format=oci containers-storage:test:tar oci:oci:test | ||
cat oci/index.json | jq . | ||
m2=$(cat oci/index.json | jq .manifests[1].digest | sed 's/sha256://' | tr -d \") | ||
cat oci/blobs/sha256/"$m2" | jq . | ||
l2=$(cat oci/blobs/sha256/"$m2" | jq .layers[0].digest | sed 's/sha256://' | tr -d \") | ||
echo "$l1" | ||
echo "$l2" | ||
[ "$l1" = "$l2" ] | ||
} | ||
|
||
@test "import tar.gz > 1M" { | ||
mkdir -p folder1 | ||
truncate -s 2m folder1/file1 | ||
tar cvzf test.tar.gz folder1 | ||
cat > stacker.yaml <<EOF | ||
tar: | ||
from: | ||
type: tar | ||
url: test.tar.gz | ||
EOF | ||
stacker build | ||
cat oci/index.json | jq . | ||
m1=$(cat oci/index.json | jq .manifests[0].digest | sed 's/sha256://' | tr -d \") | ||
cat oci/blobs/sha256/"$m1" | jq . | ||
l1=$(cat oci/blobs/sha256/"$m1" | jq .layers[0].digest | sed 's/sha256://' | tr -d \") | ||
[[ "$($SKOPEO --version)" =~ "skopeo version ${SKOPEO_VERSION}" ]] || { | ||
echo "$SKOPEO --version should be ${SKOPEO_VERSION}" | ||
exit 1 | ||
} | ||
$SKOPEO copy --format=oci oci:oci:tar containers-storage:test:tar | ||
$SKOPEO copy --format=oci containers-storage:test:tar oci:oci:test | ||
cat oci/index.json | jq . | ||
m2=$(cat oci/index.json | jq .manifests[1].digest | sed 's/sha256://' | tr -d \") | ||
cat oci/blobs/sha256/"$m2" | jq . | ||
l2=$(cat oci/blobs/sha256/"$m2" | jq .layers[0].digest | sed 's/sha256://' | tr -d \") | ||
echo "$l1" | ||
echo "$l2" | ||
[ "$l1" = "$l2" ] | ||
} |