Prerequisites

  • WSL Setup (Linux for Windows) (windows only)
  • Docker environment (Docker desktop started in windows)
  • Docker image of latest CPS-NCMP  (mvn clean install)
  • Docker image of latest DMI-Plugin  (mvn clean install)

Run CSIT

Navigate to cps/csit directory.


It is recommended to either:

  1. clone CPS into a folder on WSL and run scripts from there. The reason for this is that when using /mnt in WSL to navigate to your local folder (e.g. windows) the file formatting causes issues and the scripts don't run.
  2. Copy CPS folder to WSL. If you choose this you will need to run the following command to change the file formatting.  
find . -type f -print0 | xargs -0 dos2unix



Run the following script

sudo bash run-project-csit.sh

Note - The first time this runs it will download all the libraries defined in the CSIT scripts. This may take awhile be patient (smile)

Once the scripts have run, the output should look like the following

Disable Tear-down 

As part of this process docker containers are created for cps-and-ncmp, dbpostgresql, ncmp-dmi-plugin, mariadb and sdnc, once the testing is finished these docker containers are stopped and removed.

To prevent these docker containers from being stopped as part of this process for any reason, within the teardown.sh script located in cps/csit/plans/cps comment out the following line.

Potential issues

Local IP address not set

This issue typically appears when running the scripts from a windows WSL environment

Error response from daemon: invalid IP address in add-host: ""

To resolve this, Install and run ifconfig

sudo apt install net-tools
ifconfig

From the eth0 configuration take the inet address

Update the cps/csit/plans/cps/setup.sh to set te IP Address directly instead of extracting it using linux commands that don't work on WSL:

Save this configuration.

Run scripts again.

Port already in use

Another common reason for containers not starting is that the port is already in use.  You might see something like below:

Ports not available
Ports are not available: listen tcp 0.0.0.0:3306: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.

The commands  to check ports usage are:

  • Windows: netstat -aof 
  • Unix (WSL): netstat.exe -an | grep -i "listen" | grep -v "\[::\]" 

Stop and disable any conflicting service using the same port and try again

ModuleNotFoundError (python3 v. python)

If the tests don't run at all check  for ModuleNotFoundError like this:

/tmp/tmp.rgIeMxiRCGrobot_venv/bin/python: Error while finding module specification for 'robot.run' (ModuleNotFoundError: No module named 'robot')

This might be because of how you environment uses python2 and/or python3

In the file run-csit.sh located within the cps/csit directory

Look for the following line (almost at the end of the file):

python -m robot.run -N ${TESTPLAN} -v WORKSPACE:/tmp ${ROBOT_VARIABLES} ${TESTOPTIONS} ${SUITES}

Change this to us python3

python3 -m robot.run -N ${TESTPLAN} -v WORKSPACE:/tmp ${ROBOT_VARIABLES} ${TESTOPTIONS} ${SUITES}

Run scripts again


python setup.py egg_info did not run successfully

Problem

Collecting robotframework-selenium2library
  Using cached robotframework-selenium2library-1.8.0.tar.gz (118 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [11 lines of output]
      /usr/lib/python3/dist-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.12) or chardet (3.0.4) doesn't match a supported version!
        warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-629q8t42/robotframework-selenium2library_b2892f832c9f4471a4b59409ca658b27/setup.py", line 7, in <module>
          from ez_setup import use_setuptools
        File "/tmp/pip-install-629q8t42/robotframework-selenium2library_b2892f832c9f4471a4b59409ca658b27/src/ez_setup.py", line 106
          except pkg_resources.VersionConflict, e:
                                              ^
      SyntaxError: invalid syntax
      [end of output]
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed


Solution

Update the version in the pylibs.txt file which we use to keep track of the libraries required to run the CSITs.

Path : cps/csit/pylibs.txt

[OLD]  robotframework-selenium2library         
[NEW]  robotframework-selenium2library==3.0.0   

Unable to find include-raw-integration-install-robotframework-py3.sh

Cloning into 'ci-management'...
remote: Counting objects: 1, done
remote: Total 33485 (delta 0), reused 33485 (delta 0)
Receiving objects: 100% (33485/33485), 5.32 MiB | 8.69 MiB/s, done.
Resolving deltas: 100% (24180/24180), done.
++ source /tmp/ci-management/jjb/integration/include-raw-integration-install-robotframework-py3.sh
+++ set -eu pipefail
+++ . /root/lf-env.sh
/tmp/ci-management/jjb/integration/include-raw-integration-install-robotframework-py3.sh: line 16: /root/lf-env.sh: No such file or directory
++++ on_exit
++++ rc=1
++++ [[ -n /mnt/c/Users/LeeAnjellaMacabuhay/Documents/userStories/1393/cps/csit ]]
++++ [[ -n /tmp/tmp.ooyImAc0MW-robot-workdir ]]
++++ rsync -av /tmp/tmp.ooyImAc0MW-robot-workdir/ /mnt/c/Users/LeeAnjellaMacabuhay/Documents/userStories/1393/cps/csit/archives/plans/cps
sending incremental file list
./

Solution 

Path: csit/prepare-csit.sh replace the OLD script with the new one.

[OLD] source /tmp/ci-management/jjb/integration/include-raw-integration-install-robotframework-py3.sh
[NEW] source ${WORKSPACE}/install-robotframework.sh

System time out of Sync

If there is further issues downloading libraries due to the system date being out of sync with windows issue the following command and run the scripts again.

sudo hwclock --hctosys
  • No labels