-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mirror validation should pass with local image only; more testing for…
… mirroring (#47) * mirror validation should pass with local image only; more testing for mirror * address review
- Loading branch information
1 parent
d1ce6c5
commit d358aba
Showing
5 changed files
with
218 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/bash | ||
#!/bin/bash -x | ||
set -eu | ||
|
||
function guess_runfiles() { | ||
|
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,111 @@ | ||
#!/bin/bash -x | ||
# | ||
# This test runs the script passed as the first argument and verifies the image is pushed to the registry | ||
# | ||
${REGISTRY_BIN}& | ||
registry_pid=$! | ||
trap "kill -9 $registry_pid" EXIT | ||
|
||
echo verifying image $REMOTE does not exist | ||
${CRANE_BIN} validate -v --fast --remote $REMOTE | ||
if [ $? -eq 0 ]; then | ||
echo "Image $REMOTE should not exist" | ||
exit 1 | ||
fi | ||
|
||
echo verifying image $LOCAL does not exist | ||
${CRANE_BIN} validate -v --fast --remote $LOCAL | ||
if [ $? -eq 0 ]; then | ||
echo "Image $LOCAL should not exist" | ||
exit 1 | ||
fi | ||
|
||
#test should fail before pushing the image (no src, no dst) | ||
echo verifying mirror image validation fails | ||
${IMAGE_MIRROR_VALIDATE_SRC} | ||
if [ $? -eq 0 ]; then | ||
echo "Image verification should fail" | ||
exit 1 | ||
fi | ||
|
||
echo pushing image $SRC_IMAGE | ||
${PUSH_IMAGE} | ||
|
||
echo verifying image $REMOTE exists | ||
${CRANE_BIN} validate -v --fast --remote $REMOTE | ||
if [ $? -ne 0 ]; then | ||
echo "Image $REMOTE should exist" | ||
exit 1 | ||
fi | ||
|
||
echo verifying image $LOCAL does not exist | ||
${CRANE_BIN} validate -v --fast --remote $LOCAL | ||
if [ $? -eq 0 ]; then | ||
echo "Image $LOCAL should not exist" | ||
exit 1 | ||
fi | ||
|
||
#test should succeed with src image only | ||
echo verifying mirror image validation fails | ||
${IMAGE_MIRROR_VALIDATE_SRC} | ||
if [ $? -ne 0 ]; then | ||
echo "Image verification should succeed" | ||
exit 1 | ||
fi | ||
|
||
echo running image mirror | ||
${IMAGE_MIRROR} | ||
if [ $? -ne 0 ]; then | ||
echo "Image mirroring should succeed" | ||
exit 1 | ||
fi | ||
|
||
echo verifying image $LOCAL exists | ||
${CRANE_BIN} validate -v --fast --remote $LOCAL | ||
if [ $? -ne 0 ]; then | ||
echo "Image $LOCAL should exist" | ||
exit 1 | ||
fi | ||
|
||
echo verifying image $REMOTE exists | ||
${CRANE_BIN} validate -v --fast --remote $REMOTE | ||
if [ $? -ne 0 ]; then | ||
echo "Image $REMOTE should exist" | ||
exit 1 | ||
fi | ||
|
||
#test should succeed with src and dst images | ||
echo verifying mirror image validation succeeds | ||
${IMAGE_MIRROR_VALIDATE_SRC} | ||
if [ $? -ne 0 ]; then | ||
echo "Image verification should succeed" | ||
exit 1 | ||
fi | ||
|
||
echo removing image $REMOTE | ||
${CRANE_BIN} delete $REMOTE || exit 1 | ||
|
||
echo verifying image $REMOTE does not exist | ||
${CRANE_BIN} validate -v --fast --remote $REMOTE | ||
if [ $? -eq 0 ]; then | ||
echo "Image $REMOTE should not exist" | ||
exit 1 | ||
fi | ||
|
||
echo verifying image $LOCAL exists | ||
${CRANE_BIN} validate -v --fast --remote $LOCAL | ||
if [ $? -ne 0 ]; then | ||
echo "Image $LOCAL should exist" | ||
exit 1 | ||
fi | ||
|
||
#test should succeed with dst image only | ||
echo verifying mirror image validation succeeds | ||
${IMAGE_MIRROR_VALIDATE_SRC} | ||
if [ $? -ne 0 ]; then | ||
echo "Image verification should succeed" | ||
exit 1 | ||
fi | ||
|
||
|
||
# exit 1 |
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 |
---|---|---|
@@ -1,3 +1,20 @@ | ||
#!/bin/bash | ||
echo "Validating image $1" | ||
$CRANE_BIN validate -v --fast --remote $1 | ||
REMOTE="{src_image}" | ||
LOCAL="{dst_image}@{digest}" | ||
echo "Validating images ${REMOTE} and ${LOCAL}" | ||
{crane_tool} validate -v --fast --remote ${REMOTE} | ||
if [ $? -eq 0 ]; then | ||
echo "Image ${REMOTE} exist" | ||
exit 0 | ||
fi | ||
|
||
echo "Image ${REMOTE} does not exist, checking ${LOCAL}" | ||
|
||
{crane_tool} validate -v --fast --remote ${LOCAL} | ||
if [ $? -eq 0 ]; then | ||
echo "Image ${LOCAL} exist" | ||
exit 0 | ||
fi | ||
|
||
echo "Image ${LOCAL} does not exist" | ||
exit 1 |