Initial commit
This commit is contained in:
34
test/test.sh
Executable file
34
test/test.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
# Test the action
|
||||
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
script_dir="$(dirname "$(readlink -f "$0")")"
|
||||
|
||||
private_key=$(cat ${script_dir}/private-key)
|
||||
|
||||
output=$(docker run \
|
||||
-it --rm \
|
||||
--name test-action \
|
||||
-e SSH_PRIVATE_KEY="$private_key" \
|
||||
-e SSH_HOST="test-server" \
|
||||
-e SSH_PORT="22140" \
|
||||
-e SSH_USER="test" \
|
||||
-e REGISTRY_HOST="test-registry:5000" \
|
||||
-e REGISTRY_USER="test" \
|
||||
-e REGISTRY_PASSWORD="test" \
|
||||
--network test_network \
|
||||
docker-private-registry-ssh-action:latest)
|
||||
|
||||
|
||||
if echo $output | grep "Login Succeeded" > /dev/null; then
|
||||
echo -e "${GREEN}Test passed.${NC}"
|
||||
else
|
||||
echo -e "${RED}Test failed.${NC}"
|
||||
echo -e "Output: \n"
|
||||
echo "${output}"
|
||||
fi
|
||||
|
||||
echo -e "\n"
|
||||
Reference in New Issue
Block a user