-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix regression in v0.11.0 Change the default for writer opt 'IgnoreNoName' to be true. This was set to false, and causing the example to not run properly. A new option 'WithErrorOnNoName' has been added to be used in cases when this behaviour is expected. The existing option 'WithIgnoreNoName' has now been deprecated. A simple bash-based acceptance test has been added to prevent this issue in the future. This starts a registry, compiles the example into a binary, and makes sure it runs properly. This test is now run in CI. Signed-off-by: Josh Dolitsky <[email protected]> * Allow hostname override for CI Signed-off-by: Josh Dolitsky <[email protected]> * use plain http for example.. Signed-off-by: Josh Dolitsky <[email protected]> * Add logic to wait for registry to come up Signed-off-by: Josh Dolitsky <[email protected]>
- Loading branch information
Showing
10 changed files
with
86 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
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
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
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,43 @@ | ||
#!/bin/bash -ex | ||
|
||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
cd $DIR/../ | ||
|
||
LOCAL_REGISTRY_HOSTNAME="${LOCAL_REGISTRY_HOSTNAME:-localhost}" | ||
|
||
# Cleanup from previous runs | ||
rm -f hello.txt | ||
rm -f bin/oras-acceptance || true | ||
docker rm -f oras-acceptance-registry || true | ||
|
||
# Build the example into a binary | ||
CGO_ENABLED=0 go build -v -o bin/oras-acceptance ./examples/ | ||
|
||
# Run a test registry and expose at localhost:5000 | ||
trap "docker rm -f oras-acceptance-registry" EXIT | ||
docker run -d -p 5000:5000 \ | ||
--name oras-acceptance-registry \ | ||
index.docker.io/registry | ||
|
||
# Wait for a connection to port 5000 (timeout after 1 minute) | ||
WAIT_TIME=0 | ||
while true; do | ||
if nc -w 1 -z "${LOCAL_REGISTRY_HOSTNAME}" 5000; then | ||
echo "Able to connect to ${LOCAL_REGISTRY_HOSTNAME} port 5000" | ||
break | ||
else | ||
if (( ${WAIT_TIME} >= 60 )); then | ||
echo "Timed out waiting for connection to ${LOCAL_REGISTRY_HOSTNAME} on port 5000. Exiting." | ||
exit 1 | ||
fi | ||
echo "Waiting to connect to ${LOCAL_REGISTRY_HOSTNAME} on port 5000. Sleeping 5 seconds.." | ||
sleep 5 | ||
WAIT_TIME=$((WAIT_TIME + 5)) | ||
fi | ||
done | ||
|
||
# Run the example binary | ||
bin/oras-acceptance | ||
|
||
# Ensure hello.txt exists and contains expected content | ||
grep '^Hello World!$' hello.txt |