Forum Discussion

rte4hirsiz's avatar
rte4hirsiz
New Contributor
12 months ago

ready-api-soapui-testrunner does not pass global properties

Hi

I'm using ready-api-soapui-testrunner:3.47.0 Docker image to run my tests 

But global properties used in 

-e COMMAND_LINE

are not passed to the  project file and tests are failing.

E.g. -Gmy.jdbc.url=jdbc:mysql://remote-server:6446/databasename?user=username&password=plainpassword222

gives java.sql.SQLException: Access denied for user ''@'remote-server' which indicates that username that I have provided is not known to the testrunner.

 

Using Readyapi or command line using testrunner.bat works without any problem. Tests run and are passed.

So what is the reason to failure when running the Docker image?

3 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3

    Contents of  the entry point script of docker image and docker container start command please for better understanding.

  • #!/bin/bash

    #JAVA 17
    export JAVA_OPTS="--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.desktop/java.beans=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens java.xml/com.sun.org.apache.xerces.internal.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.desktop/java.awt=ALL-UNNAMED --add-opens java.desktop/javax.swing=ALL-UNNAMED --add-opens java.base/sun.net.www=ALL-UNNAMED --add-opens java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-opens java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-opens java.desktop/javax.swing.plaf=ALL-UNNAMED --add-opens java.desktop/javax.swing.plaf.basic=ALL-UNNAMED --add-opens jdk.jdi/com.sun.jdi=ALL-UNNAMED"

    if [ -z ${SLM_LICENSE_SERVER+x} ]; then
    # Obtaining a JProd floating license
    echo "1" | java ${JAVA_OPTS} -jar ${WORKING_FOLDER}/ready-api-license-manager-${LICENSE_MANAGER_VERSION}.jar -s ${LICENSE_SERVER};

    if [ $? != 0 ]; then
    echo "6" | java ${JAVA_OPTS} -jar ${WORKING_FOLDER}/ready-api-license-manager-${LICENSE_MANAGER_VERSION}.jar -s ${LICENSE_SERVER};
    if [ $? != 0 ]; then
    exit 101;
    fi
    fi
    else
    echo "Using SLM licensing."
    # Run using SLM license server
    if [ -z ${API_KEY+x} ]; then
    echo "API_KEY value is not specified. SLM licensing won't work!"
    exit 101
    else
    COMMAND_LINE="${COMMAND_LINE} -K$API_KEY"
    fi

    if [[ ${SLM_LICENSE_SERVER,,} =~ ^(http.*)($|:([0-9]*)) ]]; then
    SLM_HOST=${BASH_REMATCH[1]}
    PORT=${BASH_REMATCH[3]}

    COMMAND_LINE="${COMMAND_LINE} -DlicenseApiHost=${SLM_HOST}"

    if [ -n ${PORT+x} ]; then
    COMMAND_LINE="${COMMAND_LINE} -DlicenseApiPort=${PORT}"
    fi

    echo "Using SmartBear On-Premise License Manager."
    else
    echo "Using SmartBear License Management."
    fi
    fi

    # Copying the project with the dependencies

    if [ -d "$MOUNTED_PROJECT_FOLDER" ]; then
    cp -a "$MOUNTED_PROJECT_FOLDER"/. "$PROJECT_FOLDER"
    fi

    # Copying the external libraries

    if [ -d "$MOUNTED_EXT_FOLDER" ]; then
    cp -a "$MOUNTED_EXT_FOLDER"/. "$READYAPI_FOLDER"/bin/ext
    fi

    # Running the project

    sed -i "s|COMMAND_LINE|$COMMAND_LINE|" "$WORKING_FOLDER"/RunProject.sh
    sed -i "s|%project%|$PROJECT_FOLDER|g" "$WORKING_FOLDER"/RunProject.sh
    sed -i "s|%reports%|$REPORTS_FOLDER|g" "$WORKING_FOLDER"/RunProject.sh

    chmod 755 "$WORKING_FOLDER"/RunProject.sh

    "$WORKING_FOLDER"/RunProject.sh

    # Analyzing the exit code

    export EXIT_CODE=$?

    if [ $EXIT_CODE -eq 1 ]; then
    exit 102
    fi

    if [ $EXIT_CODE != 0 ]; then
    exit 103
    fi

    exit 0

  • The issue with the database connection is local to the docker execution. Running without the image works fine. The project file requires my.jdbc.url but is not passed in this case, but works fine e.g. if I run command line using the testrunner.bat.

     

    docker run -t -d -u 2287:2287 --security-opt label=disable -v /etc/ca-trust:/etc/ca-trust:ro --device=/dev/fuse --ulimit=host -u root:root --entrypoint= -v=/var/lib/jenkins/workspace/job/dbextension:/ext -e SLM_LICENSE_SERVER=http://xx:1099 -e API_KEY=* -e 'COMMAND_LINE= -Dfile.encoding=UTF-8 -Gmy.jdbc.url=jdbc:mysql://remote-server:6446/databasename?user=username&password=plainpassword222 -Gmy.jdbc.driver=com.mysql.cj.jdbc.Driver -f/var/lib/jenkins/workspace/job/soapui/reports soapui-project.xml -j -a -r "-sTestSuite Ping"' ....

     

    java.sql.SQLException: Access denied for user ''@'remote-server' 

    ERROR: script returned exit code 103