diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a010948274..d9f41def67 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,4 +3,4 @@ variables: test: script: - - docker run --rm -h pandorafms -t -v "$CI_PROJECT_DIR:$CI_PROJECT_DIR" -e CI_PROJECT_DIR="$CI_PROJECT_DIR" pandorafms/pandorafms-base /tmp/pandorafms/tests/test.sh + - docker run --rm -h pandorafms -t -v "$CI_PROJECT_DIR:/tmp/pandorafms" pandorafms/pandorafms-base /tmp/pandorafms/tests/test.sh diff --git a/tests/test.sh b/tests/test.sh index 022f0b993a..cffa8d1c36 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -1,11 +1,6 @@ #!/bin/bash SOURCE_DIR="/tmp/pandorafms" -# Work on a clean directory when using GitLab CI. -if [ "$CI_PROJECT_DIR" != "" ]; then - cp -r "$CI_PROJECT_DIR" "$SOURCE_DIR" -fi - ################################################ # Check the exit status of the last run command. # Exits if it different from 0. @@ -28,24 +23,24 @@ service httpd start check "Starting the Apache Web Server" $? # Install the Pandora FMS Console. -cd $SOURCE_DIR/pandora_console && chmod +x pandora_console_install && yes | ./pandora_console_install --install +cd /tmp/pandorafms/pandora_console && chmod +x pandora_console_install && yes | ./pandora_console_install --install check "Installing the Pandora FMS Console" $? # Create the Pandora FMS database. -cd $SOURCE_DIR/tests && chmod +x install_console.py && ./install_console.py +cd /tmp/pandorafms/tests && chmod +x install_console.py && ./install_console.py check "Creating the Pandora FMS Database" $? # Build and install the Pandora FMS Server. -cd $SOURCE_DIR/pandora_server && perl Makefile.PL && make # Do not run make test now. Some tests need files created by pandora_server_installer. +cd /tmp/pandorafms/pandora_server && perl Makefile.PL && make # Do not run make test now. Some tests need files created by pandora_server_installer. check "Building the Pandora FMS Server" $? -cd $SOURCE_DIR/pandora_server && chmod +x pandora_server_installer && ./pandora_server_installer --install +cd /tmp/pandorafms/pandora_server && chmod +x pandora_server_installer && ./pandora_server_installer --install check "Installing the Pandora FMS Server" $? sed -i -e 's/^dbuser.*/dbuser root/' /etc/pandora/pandora_server.conf -cd $SOURCE_DIR/pandora_server && make test +cd /tmp/pandorafms/pandora_server && make test check "Running tests for the Pandora FMS Server" $? # Install the Pandora FMS Agent. -cd $SOURCE_DIR/pandora_agents/unix && chmod +x pandora_agent_installer && ./pandora_agent_installer --install +cd /tmp/pandorafms/pandora_agents/unix && chmod +x pandora_agent_installer && ./pandora_agent_installer --install check "Installing the Pandora FMS Agent" $? # Start Pandora FMS services.