Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Feature/ppm 30 boardfarm docker compose #1587

Open
wants to merge 36 commits into
base: master
Choose a base branch
from

Conversation

odkq
Copy link
Collaborator

@odkq odkq commented Aug 6, 2020

This branch wraps the boardfarm tests using a python 3.5 script, dctest.py, that runs docker-compose.

The script allows for setting up the bridge with the physical device and cleaning up testing images seamlessly.

As the script is not running inside docker itself, it only uses Python 3.5 (introduced in 2015) features and no external libraries.

odkq and others added 9 commits August 6, 2020 17:17
Use directly the hostname instead of querying for the ip

Signed-off-by: pablo <[email protected]>
Entrypoint calls the json for "in compose" tests

Signed-off-by: pablo <[email protected]>
Dockerfile to create boardfarm docker image and docker-compose.yml with
the configuration for boardfarm, controller and extender

Signed-off-by: pablo <[email protected]>
It wraps docker-compose tests

- Verifies versions of docker and docker-compose
- Creates and launches boardfarm image with the correct environment
  variables
- Cleans images after building
- Returns value from boardfarm process inside the image

Signed-off-by: pablo <[email protected]>
The status are failing in CI.

The name of the container was hardcoded by mistake, use docker_name
instead.

Signed-off-by: Raphaël Mélotte <[email protected]>
Copy link
Collaborator

@rmelotte rmelotte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of small comments, but I marked most of them as nitpicks because we anyway need a follow-up PR to remove the old boardfarm job among other things.

dctest.py Show resolved Hide resolved
dctest.py Outdated Show resolved Hide resolved
dctest.py Outdated Show resolved Hide resolved
dctest.py Outdated Show resolved Hide resolved
dctest.py Outdated Show resolved Hide resolved
tests/environment.py Outdated Show resolved Hide resolved
tools/docker/boardfarm-ci/Dockerfile Outdated Show resolved Hide resolved
tools/docker/boardfarm-ci/Dockerfile Outdated Show resolved Hide resolved
tools/docker/boardfarm-ci/docker-compose.yml Show resolved Hide resolved
tools/docker/boardfarm-ci/docker-compose.yml Show resolved Hide resolved
@rmelotte
Copy link
Collaborator

Also I didn't mention it, but flake8 is complaining so you'll have to address that before you can merge: https://gitlab.com/prpl-foundation/prplMesh/-/jobs/674432838

@rmelotte
Copy link
Collaborator

I also didn't repeat it here (yet?) but in the future please try to describe what you do in the commit description.
In addition to the contributing guide you can check in the git history to see what we usually do (reviewing other pull request is also a good way to get familiar with it :-) )

odkq added 3 commits August 11, 2020 10:32
Reordered the file with this ordering, from the less likely to change to
the most:

- Dependencies to install docker and docker-compose
- Installation of docker and docker-compose
- Installation of boardfarm (from github)
- Debian dependencies to install python packages (for tests)
- Installation of the python packages (for tests)
- Debian dependencies used by the tests themselves

Signed-off-by: pablo <[email protected]>
This change scans prplmesh_config_compose.js for device names and
creates the log directory for each of them found.

The scanning is also used to look for the previous run ID when running
locally, by looking for logs/<first device name>-<X>, and then using X+1
as the new ID.

Signed-off-by: pablo <[email protected]>
@rmelotte
Copy link
Collaborator

rmelotte commented Aug 11, 2020

The boardfarm tests were passing (in the sense that there were 2 failing tests and 2 passing ones, the 2 failing ones were disabled on master) with this commit:
boardfarm-ci: Commented and reordered Dockerfile : https://gitlab.com/prpl-foundation/prplMesh/-/jobs/680364644

Then all 4 started failing, among which initial AP config failed with Can't find '\(WSC M2 Encrypted Settings\)' with this commit:
boardfarm-ci: Scan device names: https://gitlab.com/prpl-foundation/prplMesh/-/jobs/680577567

run-tests however has been failing since the beginning of this branch's history.

Copy link
Collaborator

@abelog abelog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not approving, as tests/boardfarm_plugins/boardfarm_prplmesh/devices/prplmesh_compose.py::prprlmesh_status_check should be fixed before merge of PR in my opinon. It may be reason for fails mentioned in @rmelotte comment.

dctest.py Outdated Show resolved Hide resolved
# NOTE: name arg can be also extracted from the device class itself, but test_flows.py
# don't have it. We can remove this arg as soon, as we drop test_flows.py
def __init__(self, name: str, device: None = None, is_controller: bool = False):
def __init__(self, name: str, device: None = None, is_controller: bool = False,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is still required.

tools/docker/boardfarm-ci/Dockerfile Outdated Show resolved Hide resolved
@odkq odkq force-pushed the feature/PPM-30-boardfarm-docker-compose branch from f383add to a0d8fe7 Compare August 12, 2020 11:41
odkq and others added 16 commits August 12, 2020 13:42
Use relative path on docker-compose invocation, not using
/usr/local/bin/...

Signed-off-by: pablo <[email protected]>
This prevents more than one --clean, --test, --build, etc being ran at
the same time

Signed-off-by: pablo <[email protected]>
When working on the docker-compose version of the boardfarm tests, we
thought the ALEntity names had to be the same as the name boardfarm
uses for boardfarm to be able to access them.

It turns out that boardfarm only needs PrplMeshCompose to get its name
from the boardfarm configuration file, and the ALEntity can use
another one.

Since test_flows doesn't pass a "device" parameter when constructing
an ALEntity, it HAS to use "name" instead of going through the device
to access the docker_name.

environment.py:

  - Use the name of the ALEntityDocker and RadioDocker in instead of
accessing "device".

prplmesh_compose.py:

  - When creating the ALEntity, use docker_name as the name to make
  the different docker commands work.

This will make the ALEntity usable again regardless of whether the
tests runs with boardfarm or test_flows.py.

Signed-off-by: Raphaël Mélotte <[email protected]>
With apt-get upgrade before

Signed-off-by: pablo <[email protected]>
Renamed CURRENT_UID to CURRENT_UID_GID as suggested and removed
CURRENT_ID wich was not used by agent/controller images

Signed-off-by: pablo <[email protected]>
As suggested from PR comment.

Signed-off-by: pablo <[email protected]>
Pass self.docker_name instead of fixed "controller-rme" when performing
device_get_info, as suggested by PR comment.

Signed-off-by: pablo <[email protected]>
On prplmesh_compose entry of prplmesh_config_compose.json

Signed-off-by: pablo <[email protected]>
Was removed but it is still pertinent

Signed-off-by: pablo <[email protected]>
Comment on lines 7 to 8
software-properties-common curl gcc libsnmp-dev wireshark-common tshark \
-y && apt-get clean
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need wireshark and tshark inside the boardfarm-ci image? We already know that sniffer doesn't work when we try that way. Maybe we can keep it and I'll exclude it in the PR fixing PPM-331.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I can think it is better removed on the same branch that is depending on having dumpcap installed alongside python 3.5 on the host for dctest to work (and checking the dependency -- that the executable exists -- as it is done for docker and docker-compose)

odkq added 6 commits August 14, 2020 11:57
Missing the n when restoring the original format string with \n ...

Signed-off-by: pablo <[email protected]>
An unused include and some spacess missing for PEP-8 compliance

Signed-off-by: pablo <[email protected]>
boardfarm-ci: Merging master into PPM-30-boardfarm-docker-compose

Fixing two conflicts in tests/environment.py
Signed-off-by: pablo <[email protected]>
@odkq odkq requested review from abelog and aciliketcap August 14, 2020 14:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants