Skip to contentSkip to conversation

Fuego Release Test Repository

PATCH In review Guilherme Campos Camargo 3 participants 10 messages Feb 16, 2018 – Feb 20, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fuego Release Test Repository

Hello, everyone

This repository has been created to store the resources needed for the generation of a Docker image, based on fuego-base, that has all the tools needed for the automation of the tests that are required for validating a new Fuego release with Fuego itself.

It consists basically of:

* A Dockerfile containing the installation of additional dependencies.
* A new fuego-test board (fuego-ro/boards/fuego-test)
* A functional test (tests/Functional.fuegotest) that will download a specific branch of Fuego from a repository provided by the user, start an inner container running that specific fuego release and run basic tests on it.

The functional test currently just adds a board and a test plan to the Fuego-Under-Test, reporting success if everything goes well and failure if not.

Please check the documentation (README.md) for instructions in how to build/run the image with the helper script build_and_run.sh.

Also, it's important to note that this patch represents a sort of paradigm shift in the way that tests are added to Fuego, given that:
- The software requirements are being installed through a Dockerfile that extends fuego-base.
- The test routines/plans and the new boards are moved to Fuego during build time, acting almost as an "overlay".
For that reason, it's imperative that current users/contributors provide their feedback regarding this new approach before we move on. Also, since I just started contributing with and using fuego, it's likely that I missed something, specially related to Fuego usability. So please, kindly add your comments and correct me if so.

Please also see a few more comments in the code below.

---
 Dockerfile                               | 30 ++++++++++++++
 README.md                                | 38 ++++++++++++++++++
 build_and_run.sh                         | 67 ++++++++++++++++++++++++++++++++
 fuego-ro/boards/README                   |  4 ++
 fuego-ro/boards/fuego-test.board         | 13 +++++++
 fuego-ro/conf/README                     |  1 +
 fuego-ro/conf/fuego.conf                 |  3 ++
 fuego-rt-entrypoint.sh                   | 26 +++++++++++++
 tests/Functional.fuegotest/fuego_test.sh | 36 +++++++++++++++++
 tests/Functional.fuegotest/spec.json     |  9 +++++
 tests/Functional.fuegotest/test_run.py   | 19 +++++++++
 11 files changed, 246 insertions(+)
 create mode 100644 Dockerfile
 create mode 100644 README.md
 create mode 100755 build_and_run.sh
 create mode 100644 fuego-ro/boards/README
 create mode 100644 fuego-ro/boards/fuego-test.board
 create mode 100644 fuego-ro/conf/README
 create mode 100644 fuego-ro/conf/fuego.conf
 create mode 100755 fuego-rt-entrypoint.sh
 create mode 100755 tests/Functional.fuegotest/fuego_test.sh
 create mode 100644 tests/Functional.fuegotest/spec.json
 create mode 100755 tests/Functional.fuegotest/test_run.py
Dockerfile new file +30 -0
new file mode 100644
index 0000000..5dcb755
@@ -0,0 +1,30 @@
+from fuegotest/fuego-base:latest
+
+ARG DEBIAN_FRONTEND=noninteractive
+RUN apt-get update && \
+    apt-get -yV install \
+        apt-transport-https \
+        ca-certificates \
+        curl \
+        gnupg2 \
+        python3 \
+        python3-pip \
+        software-properties-common && \
+    curl -fsSL \
+        https://download.docker.com/linux/$(\
+            source /etc/os-release; echo "$ID")/gpg \
+        | sudo apt-key add - && \
+    add-apt-repository \
+        "deb [arch=amd64] https://download.docker.com/linux/$(\
+            source /etc/os-release; echo "$ID") \
+            $(lsb_release -cs) stable" && \
+    apt-get update && \
+    apt-get -yV install \
+        docker-ce && \
+    pip3 install pexpect
+
+RUN echo "jenkins ALL = (root) NOPASSWD: /usr/bin/docker, /bin/sh" >> /etc/sudoers
+
+COPY fuego-ro /fuego-ro
+COPY tests /fuego-core/engine/tests
+COPY fuego-rt-entrypoint.sh /
README.md new file +38 -0
new file mode 100644
index 0000000..faa4d83
@@ -0,0 +1,38 @@
+# Fuego Release Test
+
+This Fuego Image has all the tools needed for the automation of the tests that
+are required for validating a new Fuego release with Fuego itself.
+
+It consists basically of:
+* A Dockerfile containing the installation of additional dependencies.
+* A new fuego-test board (fuego-ro/boards/fuego-test)
+* A functional test (tests/Functional.fuegotest) that will download a specific
+  branch of Fuego from a repository provided by the user, start an inner
+  container running that specific fuego release and run basic tests on it.
+
+## Build and Run Instructions
+
+In order to build and run the tests with minimal effort, just use the given
+`build_and_run.sh` script with the following parameters:
+
+```
+$ build_and_run.sh -r ${fuego-repo:-FUEGO_OFFICIAL_REPO} -b ${branch:-MASTER} -p ${fuego_port} up
+```
+
+In order to stop and save your session simply execute.
+
+```
+$ build_and_run.sh down
+```
+
+Please see `$ build_and_run.sh -h` for more options.
+
+
+## Additional Instructions
+
+By running fuego-release-test, as explained above, you should be able to access
+fuego through `http://localhost:${fuego_port}/fuego/`
+
+There you will see that the fuego-test board is already available and that the
+default test has been added to it. Simply use Fuego's Jenkins interface as
+usual to test Fuego itself.
build_and_run.sh new file +67 -0

67 lines not on this page · raw message

fuego-ro/boards/README new file +4 -0
new file mode 100644
index 0000000..bf20dc8
@@ -0,0 +1,4 @@
+This directory contains board files.
+
+See docs for reference on what variables should they define.
+
fuego-ro/boards/fuego-test.board new file +13 -0
new file mode 100644
index 0000000..185e0b4
@@ -0,0 +1,13 @@
+inherit "base-board"
+include "base-params"
+
+IPADDR=127.0.0.1
+SRV_IP=127.0.0.1
+#LOGIN="root"
+#PASSWORD="root"
+#SSH_KEY="path/to/id_rsa"
+BOARD_TESTDIR="$FUEGO_RW/tests"
+PLATFORM="x86_64"
+TRANSPORT="local"
+ARCHITECTURE="x86_64"
+DISTRIB="nosyslogd.dist"
fuego-ro/conf/README new file +1 -0
new file mode 100644
index 0000000..83942d4
@@ -0,0 +1 @@
+This directory is for configuration files for Fuego and associated tools.
fuego-ro/conf/fuego.conf new file +3 -0
new file mode 100644
index 0000000..0c95eae
@@ -0,0 +1,3 @@
+docker_jenkins_uid=1000
+docker_jenkins_gid=987
+jenkins_port=8090
fuego-rt-entrypoint.sh new file +18 -0
new file mode 100755
index 0000000..3c680dd
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+set -e
+
+function wait_for_fuego {
+    readonly fuego_port=${FUEGO_PORT:-8080}
+    readonly jenkins_url="http://localhost:${fuego_port}/fuego/"
+
+    echo "Waiting for Jenkins on ${jenkins_url}..."
+    while ! curl --output /dev/null --silent --head --fail "${jenkins_url}";
+    do
+        sleep 1
+    done
+}
+
+test_repo=${TEST_REPO:-https://bitbucket.org/profusionmobi/fuego}
+test_repo_escaped=$(sed 's/[&/\]/\\&/g' <<< "${test_repo}")
+sed -i "s/FUEGOTEST_REPO/${test_repo_escaped}/" /fuego-core/engine/tests/Functional.fuegotest/spec.json

As you can see, I'm using placeholders (FUEGOTEST_REPO and FUEGOTEST_BRANCH) in order to parametrize the test (those are passed by the user when running build_and_run.sh).

I feel that there might be a better way of doing this. Does anyone have any suggestion?

Also, note that we're using our own repo/branch for the fuego-under-test. This is necessary for now because there are some required changes that have not been merged yet either on master or next of the official repo (I'm sending that patch for review in a separate e-mail). The idea is to use the official repo and next as default.

+
+test_branch=${TEST_BRANCH:-"fuego-base"}
+test_branch_escaped=$(sed 's/[&/\]/\\&/g' <<< "${test_branch}")
+sed -i "s/FUEGOTEST_BRANCH/${test_branch_escaped}/" /fuego-core/engine/tests/Functional.fuegotest/spec.json +
+wait_for_fuego
+ftc add-nodes fuego-test
+ftc add-jobs -b fuego-test -t Functional.fuegotest

tests/Functional.fuegotest/fuego_test.sh new file +36 -0
new file mode 100755
index 0000000..6843b00
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+set -e
+
+readonly fuego_release_dir=fuego-release
+readonly fuego_release_img_name=fuego-release
+readonly fuego_release_container_name=fuego-release-container
+
+function test_build {
+    if [ -d ${fuego_release_dir} ]; then
+        rm -r ${fuego_release_dir}
+    fi
+    git clone --quiet --depth 1 --single-branch \
+        --branch "${FUNCTIONAL_FUEGOTEST_BRANCH}" \
+        "${FUNCTIONAL_FUEGOTEST_REPO}" \
+        "${fuego_release_dir}"
+    cd "${fuego_release_dir}"
+    git submodule update --init --recursive
+    cd -
+}
+
+function test_run {
+    cd "${fuego_release_dir}"
+    ./install.sh "${fuego_release_img_name}"
+    sudo -n docker rm -f "${fuego_release_container_name}" || true
+    sudo -n docker create -it --name "${fuego_release_container_name}" \
+        -p 8081:8080 \
+        --net="bridge" "${fuego_release_img_name}"
+
+    python3 ${TEST_HOME}/test_run.py
+    report "echo ok 1 minimal test on target"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "1" "^ok" "p"
+}
tests/Functional.fuegotest/spec.json new file +9 -0
new file mode 100644
index 0000000..703cb0d
@@ -0,0 +1,9 @@
+{
+    "testName": "Functional.fuegotest",
+    "specs": {
+        "default": {
+            "REPO":"FUEGOTEST_REPO",
+            "BRANCH":"FUEGOTEST_BRANCH"
+        }
+    }
+}
tests/Functional.fuegotest/test_run.py new file +5 -0
new file mode 100755
index 0000000..139ad9e
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+
+import pexpect
+
+# TODO: Check for errors

As you see, this test is just a very simple bootstrap. The plan is to include many more steps in it in the future.

+
+c = pexpect.spawnu('sudo docker start --interactive --attach fuego-release-container') +c.sendline('\r\n')
+c.expect('# $')
+
+print('Adding Node')
+c.sendline('ftc add-nodes docker')
+c.expect('# $', timeout=120)
+
+print('Adding Jobs')
+c.sendline('ftc add-jobs -b docker -p testplan_docker')
+c.expect('# $', timeout=120)
+
+print('Node and Jobs have been added')

Signature · 1 line
2.16.1
#1 lore raw

On Fri, Feb 16, 2018 at 7:42 PM, Guilherme Campos Camargo <[email protected]> wrote:
...

Quoted 11 lines

Also, it's important to note that this patch represents a sort of paradigm shift in the way that tests are added to Fuego, given that:
- The software requirements are being installed through a Dockerfile that extends fuego-base.
- The test routines/plans and the new boards are moved to Fuego during build time, acting almost as an "overlay".
For that reason, it's imperative that current users/contributors provide their feedback regarding this new approach before we move on. Also, since I just started contributing with and using fuego, it's likely that I missed something, specially related to Fuego usability. So please, kindly add your comments and correct me if so.

Tim, I discussed this with Guilherme and we'll formalize a proposal around the spec.json file, something along the lines:

1) test specify the debian repositories, packages and even gpg/keys (for repos). Instead of always adding the packages to the container, either by modifying the official docker image (as done before) or creating an overlay (as done by Guilherme), Fuego would make sure the repositories are added and packages are added prior to executing the tests.

JSON object would look like:

   "packages-dependencies": {
       "repositories": ["deb https://download.docker.com/linux/debian jessie"],
       "keys": ["https://download.docker.com/linux/debian/gpg"],
       "packages": ["docker-ce", "libxpto-dev"],
   }

Which would manage /etc/apt/sources.d/fuego.conf + apt-get install

2) in addition to the test scenarios variables that are pre-defined, allow user to redefined/override those when executing the test using the command line. For example fuego-release-test (fuego-rt) would default to test official repository with the branch "next", but one could override to test a private repo with a custom branch.

This would solve the need to "patch" the correct value at entrypoint.sh:

sed -i "s/FUEGOTEST_REPO/${test_repo_escaped}/"
/fuego-core/engine/tests/Functional.fuegotest/spec.json
...
ftc add-jobs -b fuego-test -t Functional.fuegotest

With something like:

ftc add-jobs -b fuego-test -t Functional.fuegotest -v
FUEGOTEST_REPO=${test_repo_escaped}

Signature · 6 lines
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN, GTalk, FaceTime: [email protected]
Skype: gsbarbieri
Mobile: +55 (16) 99354-9890gpg
#2 lore raw
Quoted 22 lines

-----Original Message-----
From: Gustavo Sverzut Barbieri
On Fri, Feb 16, 2018 at 7:42 PM, Guilherme Campos Camargo <[email protected]> wrote:
...

Quoted 11 lines

Also, it's important to note that this patch represents a sort of paradigm shift in the way that tests are added to Fuego, given that:
- The software requirements are being installed through a Dockerfile that extends fuego-base.
- The test routines/plans and the new boards are moved to Fuego during build time, acting almost as an "overlay".
For that reason, it's imperative that current users/contributors provide their feedback regarding this new approach before we move on. Also, since I just started contributing with and using fuego, it's likely that I missed something, specially related to Fuego usability. So please, kindly add your comments and correct me if so.

Tim, I discussed this with Guilherme and we'll formalize a proposal around the spec.json file, something along the lines:

Quoted 7 lines

1) test specify the debian repositories, packages and even gpg/keys (for repos). Instead of always adding the packages to the container, either by modifying the official docker image (as done before) or creating an overlay (as done by Guilherme), Fuego would make sure the repositories are added and packages are added prior to executing the tests.

Since I haven't been able to run the release-test yet, this is also going over my head.

What problem is this solving?

Is this for a test to specify additional packages for the base distribution in the docker container, that the test needs on the host?
Or is it referring to a new -dev package used for building the software for the target (but again, something that needs to be in the docker container, but is part of the toolchain)?

Would this be used for something like:
lib-cairo-dev, or netperf-server?

Quoted 21 lines

JSON object would look like:

"packages-dependencies": {
"repositories": ["deb https://download.docker.com/linux/debian
jessie"],

       "keys": ["https://download.docker.com/linux/debian/gpg"],
       "packages": ["docker-ce", "libxpto-dev"],

}

Which would manage /etc/apt/sources.d/fuego.conf + apt-get install

2) in addition to the test scenarios variables that are pre-defined, allow user to redefined/override those when executing the test using the command line. For example fuego-release-test (fuego-rt) would default to test official repository with the branch "next", but one could override to test a private repo with a custom branch.

This would solve the need to "patch" the correct value at entrypoint.sh:

   sed -i "s/FUEGOTEST_REPO/${test_repo_escaped}/"
Quoted 8 lines

/fuego-core/engine/tests/Functional.fuegotest/spec.json
...
ftc add-jobs -b fuego-test -t Functional.fuegotest

With something like:

ftc add-jobs -b fuego-test -t Functional.fuegotest -v
FUEGOTEST_REPO=${test_repo_escaped}

We've talked about adding the ability to define a test variable on the command line, when adding jobs or running tests, that would override the value contained in a spec file.

This is highly desirable.

I'm still, however, wrapping my head around the fuego release self-test case, which I don't understand yet. Talking about this feature in that context may be too much for my little brain to handle, at the moment.
-- Tim

#3 lore raw
Quoted 32 lines · On Mon, Feb 19, 2018 at 10:25 PM, <[email protected]> wrote:
Quoted 14 lines

-----Original Message-----
From: Gustavo Sverzut Barbieri
On Fri, Feb 16, 2018 at 7:42 PM, Guilherme Campos Camargo <[email protected]> wrote:
...

Quoted 7 lines

Also, it's important to note that this patch represents a sort of paradigm shift in the way that tests are added to Fuego, given that:
- The software requirements are being installed through a Dockerfile that extends fuego-base.
- The test routines/plans and the new boards are moved to Fuego during build time, acting almost as an "overlay".
For that reason, it's imperative that current users/contributors

provide

Quoted 2 lines
Quoted 2 lines

their feedback regarding this new approach before we move on. Also, since I just started contributing with and using fuego, it's likely

that

Quoted 6 lines
Quoted 2 lines

I missed something, specially related to Fuego usability. So please, kindly add your comments and correct me if so.

Tim, I discussed this with Guilherme and we'll formalize a proposal around the spec.json file, something along the lines:

Quoted 7 lines

1) test specify the debian repositories, packages and even gpg/keys (for repos). Instead of always adding the packages to the container, either by modifying the official docker image (as done before) or creating an overlay (as done by Guilherme), Fuego would make sure the repositories are added and packages are added prior to executing the tests.

Quoted 7 lines

Since I haven't been able to run the release-test yet, this is also going over my head.

What problem is this solving?

Is this for a test to specify additional packages for the base distribution in the docker container, that the test needs on the host?

Or is it referring to a new -dev package used for building the software

Quoted 4 lines

for the target (but again, something that needs to be in the docker container, but is part of the toolchain)? ​​

Would this be used for something like:

Quoted 2 lines

lib-cairo-dev, or netperf-server?

​
​
​
​As far as I understand, we should be able to specify packages for both cases you pointed out above.
The 'test_build' step, on the fuego test script (fuego_test.sh), would be responsible for making
sure all those packages are installed​ in the fuego container before
​properly ​
executing the test
​ steps.​

Barbieri might provide more comments to add to the discussion

Quoted 35 lines
Quoted 22 lines

JSON object would look like:

"packages-dependencies": {
"repositories": ["deb https://download.docker.com/linux/debian
jessie"],

       "keys": ["https://download.docker.com/linux/debian/gpg"],
       "packages": ["docker-ce", "libxpto-dev"],

}

Which would manage /etc/apt/sources.d/fuego.conf + apt-get install

2) in addition to the test scenarios variables that are pre-defined, allow user to redefined/override those when executing the test using the command line. For example fuego-release-test (fuego-rt) would default to test official repository with the branch "next", but one could override to test a private repo with a custom branch.

This would solve the need to "patch" the correct value at entrypoint.sh:

   sed -i "s/FUEGOTEST_REPO/${test_repo_escaped}/"
Quoted 8 lines

/fuego-core/engine/tests/Functional.fuegotest/spec.json
...
ftc add-jobs -b fuego-test -t Functional.fuegotest

With something like:

ftc add-jobs -b fuego-test -t Functional.fuegotest -v
FUEGOTEST_REPO=${test_repo_escaped}

We've talked about adding the ability to define a test variable on the command line, when adding jobs or running tests, that would override the value contained in a spec file.

Quoted 7 lines

This is highly desirable.

I'm still, however, wrapping my head around the fuego release self-test case, which I don't understand yet. Talking about this feature in that context may be too much for my little brain to handle, at the moment.

Sure. We can talk about that later.

Please ask if you still have questions about the self-test.

Quoted 3 lines

-- Tim

#4 lore raw
In reply to [email protected]
Quoted 38 lines · On Mon, Feb 19, 2018 at 10:25 PM, <[email protected]> wrote:
Quoted 22 lines

-----Original Message-----
From: Gustavo Sverzut Barbieri
On Fri, Feb 16, 2018 at 7:42 PM, Guilherme Campos Camargo <[email protected]> wrote:
...

Quoted 11 lines

Also, it's important to note that this patch represents a sort of paradigm shift in the way that tests are added to Fuego, given that:
- The software requirements are being installed through a Dockerfile that extends fuego-base.
- The test routines/plans and the new boards are moved to Fuego during build time, acting almost as an "overlay".
For that reason, it's imperative that current users/contributors provide their feedback regarding this new approach before we move on. Also, since I just started contributing with and using fuego, it's likely that I missed something, specially related to Fuego usability. So please, kindly add your comments and correct me if so.

Tim, I discussed this with Guilherme and we'll formalize a proposal around the spec.json file, something along the lines:

Quoted 7 lines

1) test specify the debian repositories, packages and even gpg/keys (for repos). Instead of always adding the packages to the container, either by modifying the official docker image (as done before) or creating an overlay (as done by Guilherme), Fuego would make sure the repositories are added and packages are added prior to executing the tests.

Since I haven't been able to run the release-test yet, this is also going over my head.

What problem is this solving?

Is this for a test to specify additional packages for the base distribution in the docker container, that the test needs on the host?

Quoted 6 lines

Or is it referring to a new -dev package used for building the software for the target (but again, something that needs to be in the docker container, but is part of the toolchain)?

Would this be used for something like:
lib-cairo-dev, or netperf-server?

a bit of all, these are dependencies *inside the fuego container* to build and run the tests. (nothing is installed in the user host machine).

so for tests that needs libcairo-dev to build/run, that would be the dependencies.

for tests that need the netperf-server, that would be the dependencies.

for fuego-rt, we need docker (client inside the container to contact the host to build images), also need python's pexpect, selenium and so on.

for cross-compiled tests, it would be the cross compiler toolchain. However, for toolchains/cross-compile, things may be better defined per target board/architecture, not per test...

Quoted 34 lines
Quoted 21 lines

JSON object would look like:

"packages-dependencies": {
"repositories": ["deb https://download.docker.com/linux/debian
jessie"],

       "keys": ["https://download.docker.com/linux/debian/gpg"],
       "packages": ["docker-ce", "libxpto-dev"],

}

Which would manage /etc/apt/sources.d/fuego.conf + apt-get install

2) in addition to the test scenarios variables that are pre-defined, allow user to redefined/override those when executing the test using the command line. For example fuego-release-test (fuego-rt) would default to test official repository with the branch "next", but one could override to test a private repo with a custom branch.

This would solve the need to "patch" the correct value at entrypoint.sh:

   sed -i "s/FUEGOTEST_REPO/${test_repo_escaped}/"
Quoted 8 lines

/fuego-core/engine/tests/Functional.fuegotest/spec.json
...
ftc add-jobs -b fuego-test -t Functional.fuegotest

With something like:

ftc add-jobs -b fuego-test -t Functional.fuegotest -v
FUEGOTEST_REPO=${test_repo_escaped}

We've talked about adding the ability to define a test variable on the command line, when adding jobs or running tests, that would override the value contained in a spec file.

Quoted 6 lines

This is highly desirable.

I'm still, however, wrapping my head around the fuego release self-test case, which I don't understand yet. Talking about this feature in that context may be too much for my little brain to handle, at the moment.

the big picture is:

your-linux-pc (aka: desktop)
-> runs fuego-stable (aka: stable-container)

     -> executes functional test fuego-release-test (ftc add-jobs -b

fuego-test -t Functional.fuegotest)
- download fuego from $FUEGOTEST_REPO + $FUEGOTEST_BRANCH
- generate a new docker image for that
- runs a container for that image
- executes release tests for that container (ie: calls "ftc"
for that container)
- remove that container and image
- reports back test results
<- report if fuego-release-test passed/failed

then, the parameters here (git repo and branch) must be passed from your desktop to fuego-stable so it knows what is to be tested. We can provide few fixed test scenarios, such as official git repo and
branches: master + next.

but say I have my own fork and I want to test that repo+branch, I need a way to specify that.

What Guilherme did to address that is to dyamically patch the spec.json, which is bad (just stop-gap so he can test with his own repo).

Signature · 6 lines
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN, GTalk, FaceTime: [email protected]
Skype: gsbarbieri
Mobile: +55 (16) 99354-9890
#5 lore raw
In reply to Guilherme Campos Camargo
Quoted 7 lines

-----Original Message-----
From: Guilherme Campos Camargo
Hello, everyone

This repository

What repository? https://bitbucket.org/profusionmobi/fuego?

I see a repository on bitbucket, under profusionmobi, called 'fuego-release-test'? Is that the one? I can find no mention of the repository below...

I presume I clone something, then run build_and_run.sh? Do I need to have any fuego materials pre-installed? (the 'driving' fuego?)

Thanks,
-- Tim

Quoted 410 lines

has been created to store the resources needed for the generation of a Docker image, based on fuego-base, that has all the tools needed for the automation of the tests that are required for validating a new Fuego release with Fuego itself.

It consists basically of:

* A Dockerfile containing the installation of additional dependencies.
* A new fuego-test board (fuego-ro/boards/fuego-test)
* A functional test (tests/Functional.fuegotest) that will download a specific branch of Fuego from a repository provided by the user, start an inner container running that specific fuego release and run basic tests on it.

The functional test currently just adds a board and a test plan to the Fuego-Under-Test, reporting success if everything goes well and failure if not.

Please check the documentation (README.md) for instructions in how to build/run the image with the helper script build_and_run.sh.

Also, it's important to note that this patch represents a sort of paradigm shift in the way that tests are added to Fuego, given that:
- The software requirements are being installed through a Dockerfile that extends fuego-base.
- The test routines/plans and the new boards are moved to Fuego during build time, acting almost as an "overlay".
For that reason, it's imperative that current users/contributors provide their feedback regarding this new approach before we move on. Also, since I just started contributing with and using fuego, it's likely that I missed something, specially related to Fuego usability. So please, kindly add your comments and correct me if so.

Please also see a few more comments in the code below.

---
 Dockerfile                               | 30 ++++++++++++++
 README.md                                | 38 ++++++++++++++++++
 build_and_run.sh                         | 67 ++++++++++++++++++++++++++++++++
 fuego-ro/boards/README                   |  4 ++
 fuego-ro/boards/fuego-test.board         | 13 +++++++
 fuego-ro/conf/README                     |  1 +
 fuego-ro/conf/fuego.conf                 |  3 ++
 fuego-rt-entrypoint.sh                   | 26 +++++++++++++
 tests/Functional.fuegotest/fuego_test.sh | 36 +++++++++++++++++
 tests/Functional.fuegotest/spec.json     |  9 +++++
 tests/Functional.fuegotest/test_run.py   | 19 +++++++++
 11 files changed, 246 insertions(+)
 create mode 100644 Dockerfile
 create mode 100644 README.md
 create mode 100755 build_and_run.sh
 create mode 100644 fuego-ro/boards/README
 create mode 100644 fuego-ro/boards/fuego-test.board
 create mode 100644 fuego-ro/conf/README
 create mode 100644 fuego-ro/conf/fuego.conf
 create mode 100755 fuego-rt-entrypoint.sh
 create mode 100755 tests/Functional.fuegotest/fuego_test.sh
 create mode 100644 tests/Functional.fuegotest/spec.json
 create mode 100755 tests/Functional.fuegotest/test_run.py
Dockerfile new file +26 -0
new file mode 100644
index 0000000..5dcb755
@@ -0,0 +1,30 @@
+from fuegotest/fuego-base:latest
+
+ARG DEBIAN_FRONTEND=noninteractive
+RUN apt-get update && \
+    apt-get -yV install \
+        apt-transport-https \
+        ca-certificates \
+        curl \
+        gnupg2 \
+        python3 \
+        python3-pip \
+        software-properties-common && \
+    curl -fsSL \
+        https://download.docker.com/linux/$(\
+            source /etc/os-release; echo "$ID")/gpg \
+        | sudo apt-key add - && \
+    add-apt-repository \
+        "deb [arch=amd64] https://download.docker.com/linux/$(\
+            source /etc/os-release; echo "$ID") \
+            $(lsb_release -cs) stable" && \
+    apt-get update && \
+    apt-get -yV install \
+        docker-ce && \
+    pip3 install pexpect
+
+RUN echo "jenkins ALL = (root) NOPASSWD: /usr/bin/docker, /bin/sh" >>

/etc/sudoers

Dockerfile new file +4 -0
+
+COPY fuego-ro /fuego-ro
+COPY tests /fuego-core/engine/tests
+COPY fuego-rt-entrypoint.sh /
README.md new file +3 -0
new file mode 100644
index 0000000..faa4d83
@@ -0,0 +1,38 @@
+# Fuego Release Test
+
+This Fuego Image has all the tools needed for the automation of the tests

that

README.md new file +16 -0
+are required for validating a new Fuego release with Fuego itself.
+
+It consists basically of:
+* A Dockerfile containing the installation of additional dependencies.
+* A new fuego-test board (fuego-ro/boards/fuego-test)
+* A functional test (tests/Functional.fuegotest) that will download a specific
+  branch of Fuego from a repository provided by the user, start an inner
+  container running that specific fuego release and run basic tests on it.
+
+## Build and Run Instructions
+
+In order to build and run the tests with minimal effort, just use the given
+`build_and_run.sh` script with the following parameters:
+
+```
+$ build_and_run.sh -r ${fuego-repo:-FUEGO_OFFICIAL_REPO} -b ${branch:-

MASTER} -p ${fuego_port} up
+```

README.md new file +13 -0
+
+In order to stop and save your session simply execute.
+
+```
+$ build_and_run.sh down
+```
+
+Please see `$ build_and_run.sh -h` for more options.
+
+
+## Additional Instructions
+
+By running fuego-release-test, as explained above, you should be able to

access

README.md new file +3 -0
+fuego through `http://localhost:${fuego_port}/fuego/`
+
+There you will see that the fuego-test board is already available and that

the

README.md new file +2 -0
+default test has been added to it. Simply use Fuego's Jenkins interface as
+usual to test Fuego itself.
build_and_run.sh new file +32 -0
new file mode 100755
index 0000000..e448ddf
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+source ./fuego-ro/conf/fuego.conf
+
+readonly internal_fuego_port=${jenkins_port:-8080}
+readonly fuego_rt_image=fuego-rt
+readonly fuego_rt_container=fuego-rt-container
+detached_mode_opts="--interactive --attach"
+port_opts="-p 8080:${internal_fuego_port}"
+
+usage() {
+    echo "usage: $0 [OPTIONS] up|down"
+    grep " .)\\ #" "${0}"
+    exit 0
+}
+
+[ $# -eq 0 ] && usage
+while getopts "hdcr:b:p:" arg; do
+  case $arg in
+    d) # Run in detached mode
+      detached_mode_opts=""
+      ;;
+    c) # Start from scratch, rebuilding image
+      clean_start="true"
+      ;;
+    r) # Fuego Repository to be tested (default: Fuego Official Repo)
+      fuego_repo_opts="-e TEST_REPO=${OPTARG}"
+      ;;
+    b) # Fuego Branch to be tested (default: Master)
+      fuego_branch_opts="-e TEST_BRANCH=${OPTARG}"
+      ;;
+    p) # Fuego (the stable, not the one under test) port mapped on Host

(default: 8090)

build_and_run.sh new file +35 -0
+      port_opts="-p ${OPTARG}:${internal_fuego_port}"
+      ;;
+    h | *) # Display help.
+      usage
+      exit 0
+      ;;
+  esac
+done
+shift "$((OPTIND - 1))"
+
+if [ "${1}" != "up" ] && [ "${1}" != "down" ]; then
+    usage
+fi
+
+if [ "$1" = "down" ]; then
+    docker stop ${fuego_rt_container}
+fi
+
+if [ "$1" = "up" ]; then
+    if [ -v clean_start ]; then
+        docker build -t "${fuego_rt_image}" .
+        docker rm -f "${fuego_rt_container}"
+        docker run -dit --name ${fuego_rt_container} \
+            -v /var/run/docker.sock:/var/run/docker.sock \
+            --net=bridge \
+            ${port_opts} ${fuego_rt_image}
+       docker exec \
+           ${fuego_repo_opts} \
+           ${fuego_branch_opts} \
+           -e FUEGO_PORT="${internal_fuego_port}" \
+           ${fuego_rt_container} /fuego-rt-entrypoint.sh
+       docker stop ${fuego_rt_container}
+    fi
+    docker start ${detached_mode_opts} ${fuego_rt_container}
+fi
fuego-ro/boards/README new file +4 -0
new file mode 100644
index 0000000..bf20dc8
@@ -0,0 +1,4 @@
+This directory contains board files.
+
+See docs for reference on what variables should they define.
+
fuego-ro/boards/fuego- renamed from fuego-ro/boards/fuego-test.board +0 -0

test.board
new file mode 100644
index 0000000..185e0b4

fuego-ro/boards/fuego-test.board new file +13 -0
@@ -0,0 +1,13 @@
+inherit "base-board"
+include "base-params"
+
+IPADDR=127.0.0.1
+SRV_IP=127.0.0.1
+#LOGIN="root"
+#PASSWORD="root"
+#SSH_KEY="path/to/id_rsa"
+BOARD_TESTDIR="$FUEGO_RW/tests"
+PLATFORM="x86_64"
+TRANSPORT="local"
+ARCHITECTURE="x86_64"
+DISTRIB="nosyslogd.dist"
fuego-ro/conf/README new file +1 -0
new file mode 100644
index 0000000..83942d4
@@ -0,0 +1 @@
+This directory is for configuration files for Fuego and associated tools.
fuego-ro/conf/fuego.conf new file +3 -0
new file mode 100644
index 0000000..0c95eae
@@ -0,0 +1,3 @@
+docker_jenkins_uid=1000
+docker_jenkins_gid=987
+jenkins_port=8090
fuego-rt-entrypoint.sh new file +18 -0
new file mode 100755
index 0000000..3c680dd
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+set -e
+
+function wait_for_fuego {
+    readonly fuego_port=${FUEGO_PORT:-8080}
+    readonly jenkins_url="http://localhost:${fuego_port}/fuego/"
+
+    echo "Waiting for Jenkins on ${jenkins_url}..."
+    while ! curl --output /dev/null --silent --head --fail "${jenkins_url}";
+    do
+        sleep 1
+    done
+}
+
+test_repo=${TEST_REPO:-https://bitbucket.org/profusionmobi/fuego}
+test_repo_escaped=$(sed 's/[&/\]/\\&/g' <<< "${test_repo}")
+sed -i "s/FUEGOTEST_REPO/${test_repo_escaped}/" /fuego-

core/engine/tests/Functional.fuegotest/spec.json

As you can see, I'm using placeholders (FUEGOTEST_REPO and FUEGOTEST_BRANCH) in order to parametrize the test (those are passed by the user when running build_and_run.sh).

I feel that there might be a better way of doing this. Does anyone have any suggestion?

Also, note that we're using our own repo/branch for the fuego-under-test. This is necessary for now because there are some required changes that have not been merged yet either on master or next of the official repo (I'm sending that patch for review in a separate e-mail). The idea is to use the official repo and next as default.

fuego-rt-entrypoint.sh new file +4 -0
+
+test_branch=${TEST_BRANCH:-"fuego-base"}
+test_branch_escaped=$(sed 's/[&/\]/\\&/g' <<< "${test_branch}")
+sed -i "s/FUEGOTEST_BRANCH/${test_branch_escaped}/" /fuego-

core/engine/tests/Functional.fuegotest/spec.json

fuego-rt-entrypoint.sh new file +4 -0
+
+wait_for_fuego
+ftc add-nodes fuego-test
+ftc add-jobs -b fuego-test -t Functional.fuegotest
tests/Functional.fuegotest/fuego_test.sh new file +36 -0
new file mode 100755
index 0000000..6843b00
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+set -e
+
+readonly fuego_release_dir=fuego-release
+readonly fuego_release_img_name=fuego-release
+readonly fuego_release_container_name=fuego-release-container
+
+function test_build {
+    if [ -d ${fuego_release_dir} ]; then
+        rm -r ${fuego_release_dir}
+    fi
+    git clone --quiet --depth 1 --single-branch \
+        --branch "${FUNCTIONAL_FUEGOTEST_BRANCH}" \
+        "${FUNCTIONAL_FUEGOTEST_REPO}" \
+        "${fuego_release_dir}"
+    cd "${fuego_release_dir}"
+    git submodule update --init --recursive
+    cd -
+}
+
+function test_run {
+    cd "${fuego_release_dir}"
+    ./install.sh "${fuego_release_img_name}"
+    sudo -n docker rm -f "${fuego_release_container_name}" || true
+    sudo -n docker create -it --name "${fuego_release_container_name}" \
+        -p 8081:8080 \
+        --net="bridge" "${fuego_release_img_name}"
+
+    python3 ${TEST_HOME}/test_run.py
+    report "echo ok 1 minimal test on target"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "1" "^ok" "p"
+}
tests/Functional.fuegotest/spec.json new file +9 -0
new file mode 100644
index 0000000..703cb0d
@@ -0,0 +1,9 @@
+{
+    "testName": "Functional.fuegotest",
+    "specs": {
+        "default": {
+            "REPO":"FUEGOTEST_REPO",
+            "BRANCH":"FUEGOTEST_BRANCH"
+        }
+    }
+}
tests/Functional.fuegotest/test_run.py new file +5 -0
new file mode 100755
index 0000000..139ad9e
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+
+import pexpect
+
+# TODO: Check for errors

As you see, this test is just a very simple bootstrap. The plan is to include many more steps in it in the future.

tests/Functional.fuegotest/test_run.py new file +2 -0
+
+c = pexpect.spawnu('sudo docker start --interactive --attach fuego-release-

container')

tests/Functional.fuegotest/test_run.py new file +12 -1
+c.sendline('\r\n')
+c.expect('# $')
+
+print('Adding Node')
+c.sendline('ftc add-nodes docker')
+c.expect('# $', timeout=120)
+
+print('Adding Jobs')
+c.sendline('ftc add-jobs -b docker -p testplan_docker')
+c.expect('# $', timeout=120)
+
+print('Node and Jobs have been added')
--

2.16.1

_______________________________________________
Fuego mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/fuego

#6 lore raw
Quoted 10 lines

-----Original Message-----
From: Tim.Bird

Quoted 5 lines

-----Original Message-----
From: Guilherme Campos Camargo
Hello, everyone

This repository

What repository? https://bitbucket.org/profusionmobi/fuego?

Quoted 7 lines

I see a repository on bitbucket, under profusionmobi, called 'fuego-release-test'? Is that the one? I can find no mention of the repository below...

I presume I clone something, then run build_and_run.sh? Do I need to have any fuego materials pre-installed? (the 'driving' fuego?)

I have several instances of Fuego available on my machine, but I wasn't sure if one of these was supposed to be running when I ran build_and_run.sh.

I did this:

$ git clone https://bitbucket.org/profusionmobi/fuego-release-test
$ cd fuego-release-test
$ ./build_and_run.sh -p 8080 up
Error: no such container: fuego-rt-container

----
Am I supposed to have a container named 'fuego-rt-container'?

I see other command line options:
-c to start from scratch
-d to run in detached mode

Should I be using these?

What is the meaning of 'up' and 'down'. Sorry, but I'm confused about how this works.

Please help.
-- Tim

#7 lore raw
Quoted 14 lines · On Mon, Feb 19, 2018 at 10:12 PM, <[email protected]> wrote:
Quoted 14 lines

-----Original Message-----
From: Tim.Bird

Quoted 5 lines

-----Original Message-----
From: Guilherme Campos Camargo
Hello, everyone

This repository

What repository? https://bitbucket.org/profusionmobi/fuego?

I see a repository on bitbucket, under profusionmobi, called 'fuego-release-test'? Is that the one? I can find no mention of the repository below...

Quoted 8 lines
Quoted 3 lines

I presume I clone something, then run build_and_run.sh? Do I need to have any fuego materials pre-installed? (the 'driving' fuego?)

I have several instances of Fuego available on my machine, but I wasn't sure if one of these was supposed to be running when I ran build_and_run.sh.

​You shouldn't need to have any of them running. fuego-release-test should work standalone.

Quoted 8 lines

I did this:

$ git clone https://bitbucket.org/profusionmobi/fuego-release-test
$ cd fuego-release-test
$ ./build_and_run.sh -p 8080 up
Error: no such container: fuego-rt-container
Quoted 9 lines

----
Am I supposed to have a container named 'fuego-rt-container'?

I see other command line options:
-c to start from scratch
-d to run in detached mode

Should I be using these?

​
​Sorry, Tim. As I explained in my last e-mail, just use

$./build_and_run.sh -c -p 8080 up​

​There's a bug that's requiring -c on the first time - to create the container.​

Quoted 3 lines

What is the meaning of 'up' and 'down'. Sorry, but I'm confused about how this works.

'up' would create the container (if not already present), then start it. 'down' would just 'stop' the container.

A user would then be able to restart by running './build_and_run.sh up' again,
or 'start from scratch' (erasing all saved data/logs/test results) by using './build_and_run -c up'.

Quoted 5 lines

Please help.
-- Tim

#8 lore raw
Quoted 61 lines · Guilherme Camargo
Quoted 14 lines · On Mon, Feb 19, 2018 at 10:12 PM, <[email protected]> wrote:
Quoted 14 lines

-----Original Message-----
From: Tim.Bird

Quoted 5 lines

-----Original Message-----
From: Guilherme Campos Camargo
Hello, everyone

This repository

What repository? https://bitbucket.org/profusionmobi/fuego?

I see a repository on bitbucket, under profusionmobi, called 'fuego-release-test'? Is that the one? I can find no mention of the repository below...

Quoted 8 lines
Quoted 3 lines

I presume I clone something, then run build_and_run.sh? Do I need to have any fuego materials pre-installed? (the 'driving' fuego?)

I have several instances of Fuego available on my machine, but I wasn't sure if one of these was supposed to be running when I ran build_and_run.sh.

​You shouldn't need to have any of them running. fuego-release-test should work standalone.

Quoted 8 lines

I did this:

$ git clone https://bitbucket.org/profusionmobi/fuego-release-test
$ cd fuego-release-test
$ ./build_and_run.sh -p 8080 up
Error: no such container: fuego-rt-container
Quoted 9 lines

----
Am I supposed to have a container named 'fuego-rt-container'?

I see other command line options:
-c to start from scratch
-d to run in detached mode

Should I be using these?

​
​Sorry, Tim. As I explained in my last e-mail, just use

$./build_and_run.sh -c -p 8080 up​

​There's a bug that's requiring -c on the first time - to create the container.​

Quoted 3 lines

What is the meaning of 'up' and 'down'. Sorry, but I'm confused about how this works.

Quoted 8 lines

'up' would create the container (if not already present), then start it. 'down' would just 'stop' the container.

A user would then be able to restart by running './build_and_run.sh up' again,
or 'start from scratch' (erasing all saved data/logs/test results) by using './build_and_run -c up'.

​Tim, please sync the repo again (​https://bitbucket.org/ profusionmobi/fuego-release-test​).
I've force-pushed some changes.

After that, you can just run ./build_and_run -c up.

Quoted 8 lines
Quoted 7 lines

Please help.
-- Tim

#9 lore raw
In reply to [email protected]

Hello, Tim

Quoted 9 lines · On Mon, Feb 19, 2018 at 9:56 PM, <[email protected]> wrote:
Quoted 7 lines

-----Original Message-----
From: Guilherme Campos Camargo
Hello, everyone

This repository

What repository? https://bitbucket.org/profusionmobi/fuego?

​Not this one.
​

Quoted 5 lines

I see a repository on bitbucket, under profusionmobi, called 'fuego-release-test'? Is that the one? I can find no mention of the repository below...

​Yes. That's the one. I'm sorry for not being clear on my first e-mail.
https://bitbucket.org/profusionmobi/fuego-release-test​

Quoted 5 lines

I presume I clone something, then run build_and_run.sh? Do I need to have any fuego materials pre-installed? (the 'driving' fuego?)

​You shouldn't need anything ​besides what's in fuego-release-test. And you're right. After cloning the repo, you just need to run build_and_run.sh to start a new fuego instance with a pre-installed fuego-test board and with a Functional.fuegotest job added to it.

The basic command is:
./build_and_run.sh -b YOUR_PREFERRED_PORT up

But I just noticed (as you mentioned in your next e-mail) that there's a bug that's requiring you to 'execute from scratch' at least once with.

./build_and_run.sh -c -b YOUR_PREFERRED_PORT up

Sorry. I'll fix that.

Then you can just open fuego-jenkins' interface through localhost:YOUR_PREF_PORT/fuego
and will you see that there's a fuego-test board defined (with a functional test added to it).

​

Quoted 427 lines

Thanks,
-- Tim

Quoted 33 lines

has been created to store the resources needed for the generation of a Docker image, based on fuego-base, that has all the tools needed for the automation of the tests that are required for validating a new Fuego release with Fuego itself.

It consists basically of:

* A Dockerfile containing the installation of additional dependencies.
* A new fuego-test board (fuego-ro/boards/fuego-test)
* A functional test (tests/Functional.fuegotest) that will download a specific branch of Fuego from a repository provided by the user, start an inner container running that specific fuego release and run basic tests on it.

The functional test currently just adds a board and a test plan to the Fuego-Under-Test, reporting success if everything goes well and failure if not.

Please check the documentation (README.md) for instructions in how to build/run the image with the helper script build_and_run.sh.

Also, it's important to note that this patch represents a sort of paradigm shift in the way that tests are added to Fuego, given that:
- The software requirements are being installed through a Dockerfile that extends fuego-base.
- The test routines/plans and the new boards are moved to Fuego during build time, acting almost as an "overlay".
For that reason, it's imperative that current users/contributors provide their feedback regarding this new approach before we move on. Also, since I just started contributing with and using fuego, it's likely that I missed something, specially related to Fuego usability. So please, kindly add your comments and correct me if so.

Quoted 6 lines

Please also see a few more comments in the code below.

---
 Dockerfile                               | 30 ++++++++++++++
 README.md                                | 38 ++++++++++++++++++
 build_and_run.sh                         | 67

++++++++++++++++++++++++++++++++

Quoted 64 lines
 fuego-ro/boards/README                   |  4 ++
 fuego-ro/boards/fuego-test.board         | 13 +++++++
 fuego-ro/conf/README                     |  1 +
 fuego-ro/conf/fuego.conf                 |  3 ++
 fuego-rt-entrypoint.sh                   | 26 +++++++++++++
 tests/Functional.fuegotest/fuego_test.sh | 36 +++++++++++++++++
 tests/Functional.fuegotest/spec.json     |  9 +++++
 tests/Functional.fuegotest/test_run.py   | 19 +++++++++
 11 files changed, 246 insertions(+)
 create mode 100644 Dockerfile
 create mode 100644 README.md
 create mode 100755 build_and_run.sh
 create mode 100644 fuego-ro/boards/README
 create mode 100644 fuego-ro/boards/fuego-test.board
 create mode 100644 fuego-ro/conf/README
 create mode 100644 fuego-ro/conf/fuego.conf
 create mode 100755 fuego-rt-entrypoint.sh
 create mode 100755 tests/Functional.fuegotest/fuego_test.sh
 create mode 100644 tests/Functional.fuegotest/spec.json
 create mode 100755 tests/Functional.fuegotest/test_run.py
Dockerfile new file +26 -0
new file mode 100644
index 0000000..5dcb755
@@ -0,0 +1,30 @@
+from fuegotest/fuego-base:latest
+
+ARG DEBIAN_FRONTEND=noninteractive
+RUN apt-get update && \
+    apt-get -yV install \
+        apt-transport-https \
+        ca-certificates \
+        curl \
+        gnupg2 \
+        python3 \
+        python3-pip \
+        software-properties-common && \
+    curl -fsSL \
+        https://download.docker.com/linux/$(\
+            source /etc/os-release; echo "$ID")/gpg \
+        | sudo apt-key add - && \
+    add-apt-repository \
+        "deb [arch=amd64] https://download.docker.com/linux/$(\
+            source /etc/os-release; echo "$ID") \
+            $(lsb_release -cs) stable" && \
+    apt-get update && \
+    apt-get -yV install \
+        docker-ce && \
+    pip3 install pexpect
+
+RUN echo "jenkins ALL = (root) NOPASSWD: /usr/bin/docker, /bin/sh" >>

/etc/sudoers

Dockerfile new file +4 -0
+
+COPY fuego-ro /fuego-ro
+COPY tests /fuego-core/engine/tests
+COPY fuego-rt-entrypoint.sh /
README.md new file +0 -0
new file mode 100644
index 0000000..faa4d83

README.md line 3

Quoted 3 lines
README.md new file +3 -0
@@ -0,0 +1,38 @@
+# Fuego Release Test
+
+This Fuego Image has all the tools needed for the automation of the

tests

README.md

Quoted 7 lines

that

README.md new file +6 -0
+are required for validating a new Fuego release with Fuego itself.
+
+It consists basically of:
+* A Dockerfile containing the installation of additional dependencies.
+* A new fuego-test board (fuego-ro/boards/fuego-test)
+* A functional test (tests/Functional.fuegotest) that will download a

specific

README.md

Quoted 2 lines
README.md new file +2 -0
+  branch of Fuego from a repository provided by the user, start an inner
+  container running that specific fuego release and run basic tests on

it.

README.md

Quoted 4 lines
README.md new file +4 -0
+
+## Build and Run Instructions
+
+In order to build and run the tests with minimal effort, just use the

given

Quoted 20 lines

+build_and_run.sh script with the following parameters:
+
+```
+$ build_and_run.sh -r ${fuego-repo:-FUEGO_OFFICIAL_REPO} -b ${branch:- MASTER} -p ${fuego_port} up
+```

README.md new file +13 -0
+
+In order to stop and save your session simply execute.
+
+```
+$ build_and_run.sh down
+```
+
+Please see `$ build_and_run.sh -h` for more options.
+
+
+## Additional Instructions
+
+By running fuego-release-test, as explained above, you should be able to

access

README.md

Quoted 3 lines
README.md new file +3 -0
+fuego through `http://localhost:${fuego_port}/fuego/`
+
+There you will see that the fuego-test board is already available and

that

Quoted 2 lines

the
+default test has been added to it. Simply use Fuego's Jenkins interface

as

Quoted 111 lines
README.md new file +1 -0
+usual to test Fuego itself.
build_and_run.sh new file +32 -0
new file mode 100755
index 0000000..e448ddf
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+source ./fuego-ro/conf/fuego.conf
+
+readonly internal_fuego_port=${jenkins_port:-8080}
+readonly fuego_rt_image=fuego-rt
+readonly fuego_rt_container=fuego-rt-container
+detached_mode_opts="--interactive --attach"
+port_opts="-p 8080:${internal_fuego_port}"
+
+usage() {
+    echo "usage: $0 [OPTIONS] up|down"
+    grep " .)\\ #" "${0}"
+    exit 0
+}
+
+[ $# -eq 0 ] && usage
+while getopts "hdcr:b:p:" arg; do
+  case $arg in
+    d) # Run in detached mode
+      detached_mode_opts=""
+      ;;
+    c) # Start from scratch, rebuilding image
+      clean_start="true"
+      ;;
+    r) # Fuego Repository to be tested (default: Fuego Official Repo)
+      fuego_repo_opts="-e TEST_REPO=${OPTARG}"
+      ;;
+    b) # Fuego Branch to be tested (default: Master)
+      fuego_branch_opts="-e TEST_BRANCH=${OPTARG}"
+      ;;
+    p) # Fuego (the stable, not the one under test) port mapped on Host

(default: 8090)

build_and_run.sh new file +35 -0
+      port_opts="-p ${OPTARG}:${internal_fuego_port}"
+      ;;
+    h | *) # Display help.
+      usage
+      exit 0
+      ;;
+  esac
+done
+shift "$((OPTIND - 1))"
+
+if [ "${1}" != "up" ] && [ "${1}" != "down" ]; then
+    usage
+fi
+
+if [ "$1" = "down" ]; then
+    docker stop ${fuego_rt_container}
+fi
+
+if [ "$1" = "up" ]; then
+    if [ -v clean_start ]; then
+        docker build -t "${fuego_rt_image}" .
+        docker rm -f "${fuego_rt_container}"
+        docker run -dit --name ${fuego_rt_container} \
+            -v /var/run/docker.sock:/var/run/docker.sock \
+            --net=bridge \
+            ${port_opts} ${fuego_rt_image}
+       docker exec \
+           ${fuego_repo_opts} \
+           ${fuego_branch_opts} \
+           -e FUEGO_PORT="${internal_fuego_port}" \
+           ${fuego_rt_container} /fuego-rt-entrypoint.sh
+       docker stop ${fuego_rt_container}
+    fi
+    docker start ${detached_mode_opts} ${fuego_rt_container}
+fi
fuego-ro/boards/README new file +4 -0
new file mode 100644
index 0000000..bf20dc8
@@ -0,0 +1,4 @@
+This directory contains board files.
+
+See docs for reference on what variables should they define.
+
fuego-ro/boards/fuego- renamed from fuego-ro/boards/fuego-test.board +0 -0

test.board
new file mode 100644
index 0000000..185e0b4

fuego-ro/boards/fuego-test.board new file +13 -0
@@ -0,0 +1,13 @@
+inherit "base-board"
+include "base-params"
+
+IPADDR=127.0.0.1
+SRV_IP=127.0.0.1
+#LOGIN="root"
+#PASSWORD="root"
+#SSH_KEY="path/to/id_rsa"
+BOARD_TESTDIR="$FUEGO_RW/tests"
+PLATFORM="x86_64"
+TRANSPORT="local"
+ARCHITECTURE="x86_64"
+DISTRIB="nosyslogd.dist"
fuego-ro/conf/README new file +0 -0
new file mode 100644
index 0000000..83942d4

fuego-ro/conf/README line 1

Quoted 1 line
fuego-ro/conf/README new file +1 -0
@@ -0,0 +1 @@
+This directory is for configuration files for Fuego and associated

tools.

Quoted 15 lines
fuego-ro/conf/fuego.conf new file +3 -0
new file mode 100644
index 0000000..0c95eae
@@ -0,0 +1,3 @@
+docker_jenkins_uid=1000
+docker_jenkins_gid=987
+jenkins_port=8090
fuego-rt-entrypoint.sh new file +0 -0
new file mode 100755
index 0000000..3c680dd

fuego-rt-entrypoint.sh line 10

Quoted 10 lines
fuego-rt-entrypoint.sh new file +10 -0
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+set -e
+
+function wait_for_fuego {
+    readonly fuego_port=${FUEGO_PORT:-8080}
+    readonly jenkins_url="http://localhost:${fuego_port}/fuego/"
+
+    echo "Waiting for Jenkins on ${jenkins_url}..."
+    while ! curl --output /dev/null --silent --head --fail

"${jenkins_url}";

Quoted 55 lines
fuego-rt-entrypoint.sh new file +8 -0
+    do
+        sleep 1
+    done
+}
+
+test_repo=${TEST_REPO:-https://bitbucket.org/profusionmobi/fuego}
+test_repo_escaped=$(sed 's/[&/\]/\\&/g' <<< "${test_repo}")
+sed -i "s/FUEGOTEST_REPO/${test_repo_escaped}/" /fuego-

core/engine/tests/Functional.fuegotest/spec.json

As you can see, I'm using placeholders (FUEGOTEST_REPO and FUEGOTEST_BRANCH) in order to parametrize the test (those are passed by the user when running build_and_run.sh).

I feel that there might be a better way of doing this. Does anyone have any suggestion?

Also, note that we're using our own repo/branch for the fuego-under-test. This is necessary for now because there are some required changes that have not been merged yet either on master or next of the official repo (I'm sending that patch for review in a separate e-mail). The idea is to use the official repo and next as default.

fuego-rt-entrypoint.sh new file +4 -0
+
+test_branch=${TEST_BRANCH:-"fuego-base"}
+test_branch_escaped=$(sed 's/[&/\]/\\&/g' <<< "${test_branch}")
+sed -i "s/FUEGOTEST_BRANCH/${test_branch_escaped}/" /fuego-

core/engine/tests/Functional.fuegotest/spec.json

fuego-rt-entrypoint.sh new file +4 -0
+
+wait_for_fuego
+ftc add-nodes fuego-test
+ftc add-jobs -b fuego-test -t Functional.fuegotest
tests/Functional.fuegotest/fuego_test.sh new file +16 -0
new file mode 100755
index 0000000..6843b00
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+set -e
+
+readonly fuego_release_dir=fuego-release
+readonly fuego_release_img_name=fuego-release
+readonly fuego_release_container_name=fuego-release-container
+
+function test_build {
+    if [ -d ${fuego_release_dir} ]; then
+        rm -r ${fuego_release_dir}
+    fi
+    git clone --quiet --depth 1 --single-branch \
+        --branch "${FUNCTIONAL_FUEGOTEST_BRANCH}" \
+        "${FUNCTIONAL_FUEGOTEST_REPO}" \
+        "${fuego_release_dir}"

tests/Functional.fuegotest/fuego_test.sh line 26

Quoted 10 lines
tests/Functional.fuegotest/fuego_test.sh new file +10 -0
+    cd "${fuego_release_dir}"
+    git submodule update --init --recursive
+    cd -
+}
+
+function test_run {
+    cd "${fuego_release_dir}"
+    ./install.sh "${fuego_release_img_name}"
+    sudo -n docker rm -f "${fuego_release_container_name}" || true
+    sudo -n docker create -it --name "${fuego_release_container_name}"

\

Quoted 42 lines
tests/Functional.fuegotest/fuego_test.sh new file +10 -0
+        -p 8081:8080 \
+        --net="bridge" "${fuego_release_img_name}"
+
+    python3 ${TEST_HOME}/test_run.py
+    report "echo ok 1 minimal test on target"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "1" "^ok" "p"
+}
tests/Functional.fuegotest/spec.json new file +9 -0
new file mode 100644
index 0000000..703cb0d
@@ -0,0 +1,9 @@
+{
+    "testName": "Functional.fuegotest",
+    "specs": {
+        "default": {
+            "REPO":"FUEGOTEST_REPO",
+            "BRANCH":"FUEGOTEST_BRANCH"
+        }
+    }
+}
tests/Functional.fuegotest/test_run.py new file +5 -0
new file mode 100755
index 0000000..139ad9e
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+
+import pexpect
+
+# TODO: Check for errors

As you see, this test is just a very simple bootstrap. The plan is to include many more steps in it in the future.

tests/Functional.fuegotest/test_run.py

Quoted 2 lines
tests/Functional.fuegotest/test_run.py new file +2 -0
+
+c = pexpect.spawnu('sudo docker start --interactive --attach

fuego-release-

Quoted 20 lines

container')

tests/Functional.fuegotest/test_run.py new file +12 -1
+c.sendline('\r\n')
+c.expect('# $')
+
+print('Adding Node')
+c.sendline('ftc add-nodes docker')
+c.expect('# $', timeout=120)
+
+print('Adding Jobs')
+c.sendline('ftc add-jobs -b docker -p testplan_docker')
+c.expect('# $', timeout=120)
+
+print('Node and Jobs have been added')
--

2.16.1

_______________________________________________
Fuego mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/fuego