Cannot execute a custom script on remote server from docker executor

I’m working on the CI/CD using Docker Executor.

The pipeline basically perform ssh session to the target host in order to execute a script.
here is the stage

check_port:
    stage: check_port
    before_script:
        - 'which ssh-agent || (apk add openssh-client)'
        - eval "$(ssh-agent -s)"
        - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
        - mkdir -p ~/.ssh
        - chmod 700 ~/.ssh
    script:
        - export SSH_DEPLOY_SERVER="ssh -o StrictHostKeyChecking=no ${DEPLOY_USER}@${DEPLOY_SERVER}"
        - >
            if [ ${CURRENT_BRANCH} == 'feature' ]; then
                echo "Feature branch, checking selected port..."
                ${SSH_DEPLOY_SERVER} "cd /test/scripts/; ls -lrt;
                is_port_unused=$(./test/scripts/check_port ${PORT} ${SERVICE_NAME} ${CI_PROJECT_NAME});

first, I’ve declared a variable which hold a ssh command as SSH_SERVER and this will be used for the next line

then calling the SSH_SERVER to start ssh session, navigate to the directory, and list all the files
yes…the file check_port is exists there with permission 777

next, the variable is_port_unused must keep the output from check_port script which locates under /test/scripts. but the error occur…

logs from gitlab-runner

Feature branch, checking selected port…

35/bin/bash: line 153: ./test/scripts/check_port: No such file or director

I’ve tried to change many of YAML formats like is_port_unused=./test/scripts/check_port ${PORT} ${SERVICE_NAME} ${CI_PROJECT_NAME}; not working as well

Ubuntu 20.04 LTS

gitlab-runner --version
Version:      13.10.0
Git revision: 54944146
Git branch:   13-10-stable
GO version:   go1.13.8
Built:        2021-03-21T09:13:32+0000
OS/Arch:      linux/amd64