Skip to content

Commit

Permalink
welp
Browse files Browse the repository at this point in the history
  • Loading branch information
cseeman committed Oct 15, 2024
1 parent 06c3575 commit 841bd05
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
5 changes: 5 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ check_cache() {
fi
}

check_folder() {
make_relative_remote "$SRC_PATH" "$REMOTE_PATH"
}

sync_files() {
#create multiplex connection
ssh -nNf -v -i "${WPE_SSHG_KEY_PRIVATE_PATH}" -o StrictHostKeyChecking=no -o ControlMaster=yes -o ControlPath="$SSH_PATH/ctl/%C" "$WPE_FULL_HOST"
Expand Down Expand Up @@ -146,4 +150,5 @@ setup_env
setup_ssh_dir
check_lint
check_cache
check_folder
sync_files
18 changes: 14 additions & 4 deletions tests/test-make-relative-remote/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,22 @@ test_make_relative_remote() {
echo -e "${GREEN}REMOTE_PATH='$REMOTE_PATH' SRC_PATH='$SRC_PATH'${NC}"
make_relative_remote

# Only compare the expected directory structure if REMOTE_PATH is not empty
# Only compare the expected directory structure if REMOTE_PATH is not empty and REMOTE_PATH is not equal to SRC_PATH
if [[ -n "$REMOTE_PATH" && "$REMOTE_PATH" != "$SRC_PATH" ]]; then
# Verify that REMOTE_PATH and its folders exist in /workspace
echo "Verifying that REMOTE_PATH and its folders exist in /workspace"
# Verify that REMOTE_PATH and its folders exist in /workspace
if [ -d "/workspace/$REMOTE_PATH" ]; then
echo -e "${GREEN}REMOTE_PATH exists in /workspace"
echo -e "${GREEN}REMOTE_PATH exists in /workspace${NC}"

# Compare the contents of the moved REMOTE_PATH to the corresponding files in the data directory
EXPECTED_PATH="${SCRIPT_DIR}/data/repository-${1}/$SRC_PATH"
diff -r "/workspace/$REMOTE_PATH" "$EXPECTED_PATH"

# Check the result of the diff command
if [[ $? -ne 0 ]]; then
echo -e "${RED}Verification failed: expected structure does not match.${NC}"
else
echo -e "${GREEN}Verification passed: expected structure matches.${NC}"
fi
else
echo -e "${RED}Verification failed: REMOTE_PATH does not exist in /workspace.${NC}"
fi
Expand Down

0 comments on commit 841bd05

Please sign in to comment.