IBM / BlueXolo

BlueXolo
Apache License 2.0
19 stars 20 forks source link

As a user is not posible to run keywords or any robot testing item. #344

Open snvc00 opened 4 years ago

snvc00 commented 4 years ago

Describe the bug As a user is not posible to run keywords or any robot testing item.

To Reproduce Steps to reproduce the behavior:

  1. Go to http://localhost:8000/testings/[keywords, testcases, testsuites]/
  2. Click on '+' and create a new testing item.
  3. Click on the run, and select a profile.
  4. See error

Expected behavior The user should be able to run the create Keywords, Test Cases and Test Suites, and an execution report need to be displayed.

snvc00 commented 4 years ago

Approach using an external container running Robot Framework

1. Create a new directory and add a Dockerfile with the following instructions:

FROM python:2
RUN apt-get update && 
apt-get install -y openssh-server && python -m pip install robotframework==2.8.7 && 
python -m pip install robotframework-requests==0.6.4 && 
python -m pip install robotframework-sshlibrary==2.1.2
RUN echo "root:Password" | chpasswd
EXPOSE 22

2. Build the created Dockerfile:

docker build -t robot2 <pathToDockerfile>

3. Modify the shell script start-bluexolo.sh located in docker/tools/ :

#!/bin/bash

# Create private network
docker network create --subnet=172.18.0.0/16 bxnetwork

# Run bluexolo 
nohup docker run --privileged \
 -p 8000:8000 \
 -h bluexolo \
 --net bxnetwork --ip 172.18.0.22 \
-e container=docker \
-v /sys/fs/cgroup:/sys/fs/cgroup \
-v /opt/sources/BlueXolo:/opt/BlueXolo-src \
-v /opt/bluexolo-data:/var/lib/postgresql \
--name bluexolo \
bluexolo/bluexolo  &

4. Add the following line at the end of the stop-bluexolo.sh script:

docker network rm bxnetwork

Remove the private network when BlueXolo is not running.

5. Run the start-bluexolo.sh script using the following command located in the docker/tools directory:

sudo ./start-bluexolo.sh

6. Run the robot2 docker image:

nohup docker run -it -d --privileged --net bxnetwork --ip 172.18.0.22 robot2:latest &

7. Retrieve the container ID of the running robot2 image with:

docker ps

8. Entry to the bash of the container using:

docker exec -it <containerID> /bin/bash

9. Start the SSH service

service shh start

10. Add your user in robot2 container and give permissions to associated directories:

adduser yourUser
chmod -R 777 home
chmod 777 media

11. Create four Local Network Connection parameters in BlueXolo:

12. Create a Local Network Connection template including the created parameters.

13. Create a new profile using the created template and fill the parameters.

user: yourUser host: 172.18.0.23 (IP of the robot2 container) passwd: [passwordUsedInTheUserCreation] path: /home/[yourUser]/

14. Now select this profile at the execution moment of any testing item in BlueXolo.

snvc00 commented 4 years ago

Approach installing needed resources in BlueXolo docker image

1. Add the following instruction in the Dockerfile located in /BlueXolo/docker/ to expose port 22 :

EXPOSE 22

2. Verify that the port 22 is not listening any process:

sudo lsof -i:22

If there is a process associated with the port just use sudo kill [PID]

3. Execute the shell script start-bluexolo.sh located in docker/tools/ :

sudo ./start-bluexolo.sh

4. Entry to the bash of the container using:

sudo docker exec -ti bluexolo /bin/bash

Or use the attach-bluexolo.sh script

5. Execute the following command:

apt-get update && apt install -y python python-pip && 
apt-get install -y openssh-server && 
python -m pip install robotframework==2.8.7 robotframework-requests==0.6.4 robotframework-sshlibrary==2.1.2 &&
apt-get install net-tools

6. Retrieve the IP of the running instance of BlueXolo:

ifconfig -a

7. Add your user in BlueXolo container and give permissions to associated directories:

adduser yourUser
chmod -R 777 /home
chmod 777 /media

8. Create four Local Network Connection parameters in BlueXolo:

9. Create a Local Network Connection template including the created parameters.

10. Create a new profile using the created template and fill the parameters.

user: yourUser host: [runningDockerContainerIP] passwd: [passwordUsedInTheUserCreation] path: /home/[yourUser]

11. Now select this profile at the execution moment of any testing item in BlueXolo.

Important: Once the execution was complete, check #344 to open the generated report correctly.

Grixtli commented 4 years ago

@fquinteroa

Fer Quintero will verify if we can integrate the fix of issue 344 in our docker image

Grixtli commented 4 years ago

@snvc00 need to add more documentation about this scenario to define if we are going to include these steps in a new build (image)

Grixtli commented 4 years ago

info added in throubleshooting section

Grixtli commented 4 years ago

re-opening this story Santiago shared with us to proposals to fix this issue. Per today working session we decided to implement a try catch to verify if we can use robot or pybot commands to execute commands.

@snvc00 add here an overview of the fix proposal and how should be implemented. If we need more hands you can make this story an EPIC and create stories inside the epic.

Grixtli commented 4 years ago

Need to investigate why the testcase folder is not being created.

snvc00 commented 4 years ago

The following problems were detected and will be fixed: