All of lore.kernel.org
 help / color / mirror / Atom feed
* [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest
@ 2018-03-07 19:54 Guilherme Campos Camargo
  2018-03-07 19:54 ` [Fuego] [PATCH 01/11] Add fuego-release Functional test Guilherme Campos Camargo
                   ` (11 more replies)
  0 siblings, 12 replies; 17+ messages in thread
From: Guilherme Campos Camargo @ 2018-03-07 19:54 UTC (permalink / raw)
  To: fuego

Hello, Tim

Please see a few more commits that have been added to Functional.fuegotest.
They include bug-fixes and some new tests (Shell and Selenium).

Not sure if you had the chance to take a look at my previous patches yet, but
if not, please consider using these one instead.

There are many commits, but most of them are pretty small. Please feel
free to ask me to squash some of them if you prefer.

To run these, you will need to checkout the `fuego-test` branch from
Profusion's fuego and fuego-core forks and then simply use fuego as usual to
add the fuego-test board and the Functional.fuegotest test.

In summary:

On host:
git clone --branch fuego-test https://bitbucket.org/profusionmobi/fuego-core.git
git clone --branch fuego-test https://bitbucket.org/profusionmobi/fuego.git
cd fuego
./install.sh
./fuego-host-scripts/docker-remove-container.sh
./fuego-host-scripts/docker-create-container.sh
./fuego-host-scripts/docker-start-container.sh

In fuego:
ftc add-nodes fuego-test
ftc add-jobs -b fuego-test -t Functional.fuegotest

Then you will be able to start the test through Jenkins and see the results.

Please let us know if you have any questions.

Guilherme Campos Camargo (11):
  Add fuego-release Functional test
  Mount fuego-rw/ro/core into the fuego-under-test container
  Use fuego-test branch to avoid install problems
  Increase wait_for_jenkins timeout from 10 to 60s
  Print fuego repo/branch information during test build
  Properly check install return code and abort in case of failure
  Allow the user to keep the container running after the test
  Add Back() Selenium Command
  Add ClickLink selenium command
  Include add-jobs, add-views and build-jobs tests
  Write ok/fail on test report

 engine/tests/Functional.fuegotest/fuego_test.sh |  36 ++
 engine/tests/Functional.fuegotest/spec.json     |  11 +
 engine/tests/Functional.fuegotest/test_run.py   | 552 ++++++++++++++++++++++++
 3 files changed, 599 insertions(+)
 create mode 100755 engine/tests/Functional.fuegotest/fuego_test.sh
 create mode 100644 engine/tests/Functional.fuegotest/spec.json
 create mode 100755 engine/tests/Functional.fuegotest/test_run.py

-- 
2.16.2


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Fuego] [PATCH 01/11] Add fuego-release Functional test
  2018-03-07 19:54 [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest Guilherme Campos Camargo
@ 2018-03-07 19:54 ` Guilherme Campos Camargo
  2018-03-07 19:54 ` [Fuego] [PATCH 02/11] Mount fuego-rw/ro/core into the fuego-under-test container Guilherme Campos Camargo
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Guilherme Campos Camargo @ 2018-03-07 19:54 UTC (permalink / raw)
  To: fuego

Allows Fuego to test new Fuego releases

Signed-off-by: Guilherme Campos Camargo <guicc@profusion.mobi>
---
 engine/tests/Functional.fuegotest/fuego_test.sh |  29 ++
 engine/tests/Functional.fuegotest/spec.json     |  11 +
 engine/tests/Functional.fuegotest/test_run.py   | 427 ++++++++++++++++++++++++
 3 files changed, 467 insertions(+)
 create mode 100755 engine/tests/Functional.fuegotest/fuego_test.sh
 create mode 100644 engine/tests/Functional.fuegotest/spec.json
 create mode 100755 engine/tests/Functional.fuegotest/test_run.py

diff --git a/engine/tests/Functional.fuegotest/fuego_test.sh b/engine/tests/Functional.fuegotest/fuego_test.sh
new file mode 100755
index 0000000..192c15b
--- /dev/null
+++ b/engine/tests/Functional.fuegotest/fuego_test.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+set -e
+
+readonly fuego_release_dir=fuego-release
+
+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_FUEGOBRANCH}" \
+        "${FUNCTIONAL_FUEGOTEST_FUEGOREPO}" \
+        "${fuego_release_dir}/fuego"
+    git clone --quiet --depth 1 --single-branch \
+        --branch "${FUNCTIONAL_FUEGOTEST_FUEGOCOREBRANCH}" \
+        "${FUNCTIONAL_FUEGOTEST_FUEGOCOREREPO}" \
+        "${fuego_release_dir}/fuego-core"
+    cd -
+}
+
+function test_run {
+    sudo -n ${TEST_HOME}/test_run.py "${fuego_release_dir}/fuego"
+    report "echo ok 1 minimal test on target"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "1" "^ok" "p"
+}
diff --git a/engine/tests/Functional.fuegotest/spec.json b/engine/tests/Functional.fuegotest/spec.json
new file mode 100644
index 0000000..42e8ac1
--- /dev/null
+++ b/engine/tests/Functional.fuegotest/spec.json
@@ -0,0 +1,11 @@
+{
+    "testName": "Functional.fuegotest",
+    "specs": {
+        "default": {
+            "FUEGOREPO":"https://bitbucket.org/profusionmobi/fuego",
+            "FUEGOBRANCH":"next",
+            "FUEGOCOREREPO":"https://bitbucket.org/profusionmobi/fuego-core",
+            "FUEGOCOREBRANCH":"next"
+        }
+    }
+}
diff --git a/engine/tests/Functional.fuegotest/test_run.py b/engine/tests/Functional.fuegotest/test_run.py
new file mode 100755
index 0000000..96fcfb7
--- /dev/null
+++ b/engine/tests/Functional.fuegotest/test_run.py
@@ -0,0 +1,427 @@
+#!/usr/bin/env python3
+import argparse
+import http
+import http.client
+import logging
+import os
+import re
+import subprocess
+import sys
+import time
+
+import docker
+import pexpect
+import requests
+from selenium import webdriver
+
+LOGGER = logging.getLogger('test_run')
+STREAM_HANDLER = logging.StreamHandler()
+STREAM_HANDLER.setFormatter(
+    logging.Formatter('%(name)s:%(levelname)s: %(message)s'))
+LOGGER.setLevel(logging.DEBUG)
+LOGGER.addHandler(STREAM_HANDLER)
+
+
+def loop_until_timeout(func, timeout=10, num_tries=5):
+    LOGGER.debug('Running %s()', func.__name__)
+
+    for _ in range(num_tries):
+        LOGGER.debug('  Try number %s...', _ + 1)
+        if func():
+            LOGGER.debug('  Success')
+            return True
+        time.sleep(timeout/num_tries)
+    LOGGER.debug('  Failure')
+
+    return False
+
+
+class SeleniumCommand:
+    def exec(self, selenium_ctx):
+        self.driver = selenium_ctx.driver
+        self.driver.refresh()
+        self.driver.implicitly_wait(3)
+        LOGGER.debug('Executing Selenium Command \'%s\'',
+                     self.__class__.__name__)
+
+
+class Visit(SeleniumCommand):
+    def __init__(self, url, timeout=10, expected_result=200):
+        self.url = url
+        self.timeout = timeout
+        self.expected_result = expected_result
+
+    def exec(self, selenium_ctx):
+        super().exec(selenium_ctx)
+
+        LOGGER.debug('  Visiting \'%s\'', self.url)
+        self.driver.get(self.url)
+
+        r = requests.get(self.url)
+        if r.status_code != self.expected_result:
+            LOGGER.debug('  HTTP Status Code \'%s\' is different '
+                         'from the expected \'%s\'', r.status_cod, self.url)
+            return False
+
+        LOGGER.debug('  HTTP Status Code is same as expected \'%s\'',
+                     r.status_code)
+        return True
+
+
+class CheckText(SeleniumCommand):
+    def __init__(self, _id, text, expected_result=True):
+        self._id = _id
+        self.text = text
+        self.expected_result = expected_result
+
+    def exec(self, selenium_ctx):
+        super().exec(selenium_ctx)
+
+        try:
+            text = self.driver.find_element_by_id(self._id).text
+        except Exception:  # TODO: Use proper Exception
+            return False
+
+        LOGGER.debug(
+            '  Searching for \'%s\' in \'id:%s\'', self.text, self._id)
+
+        result = True
+        if self.text not in text:
+            LOGGER.error(
+                '  \'%s\' not found in id \'%s\' with text \'%s\'', self.text,
+                self._id, text)
+            result = False
+
+        LOGGER.debug('  \'%s\' was found', self.text)
+
+        return result == self.expected_result
+
+
+class ShExpect():
+    BASH_PATTERN = 'test_run_pr1:#'
+    COMMAND_RESULT_PATTERN = re.compile('^([0-9]+)', re.M)
+    OUTPUT_VARIABLE = 'cmd_output'
+    COMMAND_OUTPUT_DELIM = ':test_run_cmd_out:'
+    COMMAND_OUTPUT_PATTERN = re.compile(
+        r'^{0}(.*){0}\s+{1}'.format(
+            COMMAND_OUTPUT_DELIM, BASH_PATTERN), re.M | re.S)
+
+    def __init__(self, cmd, expected_output=None, expected_result=0):
+        self.cmd = cmd
+        self.expected_result = expected_result
+        self.expected_output = expected_output
+
+    def exec(self, pexpect_ctx):
+        self.client = pexpect_ctx.client
+
+        LOGGER.debug('Executing command \'%s\'', self.cmd)
+        try:
+            self.client.sendline('{}=$({} 2>&1)'.format(
+                self.OUTPUT_VARIABLE, self.cmd))
+            self.client.expect(self.BASH_PATTERN)
+
+            self.client.sendline('echo $?')
+            self.client.expect(self.COMMAND_RESULT_PATTERN)
+            result = int(self.client.match.group(1))
+
+            self.client.sendline(
+                'echo "{0}${{{1}}}{0}"'.format(
+                    self.COMMAND_OUTPUT_DELIM,
+                    self.OUTPUT_VARIABLE))
+            self.client.expect(self.COMMAND_OUTPUT_PATTERN)
+            out = self.client.match.group(1)
+
+            if result != self.expected_result:
+                LOGGER.error('The command \'%s\' returned the code \'%d\', '
+                             'but the expected code is \'%d\''
+                             '\nCommand output: \'%s\'',
+                             self.cmd, result, self.expected_result, out)
+                return False
+            if self.expected_output is not None and \
+                    re.search(self.expected_output, out) is None:
+                LOGGER.error('Wrong output for command \'%s\'. '
+                             'Expected \'%s\'\nReceived \'%s\'',
+                             self.cmd, self.expected_output, out)
+                return False
+        except pexpect.exceptions.TIMEOUT:
+            LOGGER.error('Timeout for command \'%s\'', self.cmd)
+            return False
+        except pexpect.exceptions.EOF:
+            LOGGER.error('Lost connection with docker. Aborting')
+            return False
+        return True
+
+
+class FuegoContainer:
+    def __init__(self, install_script, image_name, container_name,
+                 jenkins_port):
+        self.install_script = install_script
+        self.image_name = image_name
+        self.container_name = container_name
+        self.jenkins_port = jenkins_port
+
+        self.docker_client = docker.APIClient()
+        self.container = self.setup_docker()
+
+    def __del__(self):
+        if self.container:
+            LOGGER.debug('Removing Container')
+            self.container.remove(force=True)
+
+    def stop(self):
+        self.container.remove(force=True)
+        self.container = None
+
+    def setup_docker(self):
+        cmd = './{} {}'.format(self.install_script, self.image_name)
+        LOGGER.debug('Running \'%s\' to install the docker image. '
+                     'This may take a while....', cmd)
+        status = subprocess.call(cmd, shell=True)
+        if status != 0:
+            return None
+        docker_client = docker.from_env()
+        containers = docker_client.containers.list(
+            all=True, filters={'name': self.container_name})
+        if containers:
+            LOGGER.debug(
+                'Erasing the container \'%s\', so a new one can be created',
+                self.container_name)
+            containers[0].remove(force=True)
+
+        container = docker_client.containers.create(
+            self.image_name,
+            stdin_open=True, tty=True, network_mode='bridge',
+            name=self.container_name, command='/bin/bash')
+        LOGGER.debug('Container \'%s\' created', self.container_name)
+        return container
+
+    def is_running(self):
+        try:
+            container_status = self.docker_client.\
+                inspect_container(self.container_name)['State']['Running']
+        except KeyError:
+            return False
+
+        return container_status
+
+    def get_ip(self):
+        container_addr = None
+
+        if not self.is_running():
+            return None
+
+        def fetch_ip():
+            nonlocal container_addr
+            try:
+                container_addr = self.docker_client.\
+                    inspect_container(
+                        self.container_name)['NetworkSettings']['IPAddress']
+            except KeyError:
+                return False
+
+            return False if container_addr is None else True
+
+        if not loop_until_timeout(fetch_ip, timeout=10):
+            LOGGER.error('Could not fetch the container IP address')
+            return None
+
+        return container_addr
+
+    def get_url(self):
+        container_addr = self.get_ip()
+
+        if container_addr:
+            return 'http://{}:{}/fuego/'.\
+                format(container_addr, self.jenkins_port)
+        else:
+            return None
+
+
+class PexpectContainerSession():
+    def __init__(self, container, start_script, timeout):
+        self.container = container
+        self.start_script = start_script
+        self.timeout = timeout
+
+    def start(self):
+        LOGGER.debug(
+            'Starting container \'%s\'', self.container.container_name)
+        self.client = pexpect.spawnu(
+            '{} {}'.format(
+                self.start_script, self.container.container_name),
+            echo=False, timeout=self.timeout)
+
+        PexpectContainerSession.set_ps1(self.client)
+
+        if not self.wait_for_jenkins():
+            return False
+
+        return True
+
+    def __del__(self):
+        self.client.terminate(force=True)
+
+    @staticmethod
+    def set_ps1(client):
+        client.sendline('export PS1="{}"'.format(ShExpect.BASH_PATTERN))
+        client.expect(ShExpect.BASH_PATTERN)
+
+    def wait_for_jenkins(self):
+        def ping_jenkins():
+            try:
+                conn = http.client.HTTPConnection(container_addr,
+                                                  self.container.jenkins_port,
+                                                  timeout=30)
+                conn.request('HEAD', '/fuego/')
+                resp = conn.getresponse()
+                version = resp.getheader('X-Jenkins')
+                status = resp.status
+                conn.close()
+                LOGGER.debug(
+                    '  HTTP Response code: \'%d\' - Jenkins Version: \'%s\'',
+                    status, version)
+                if status == http.client.OK and version is not None:
+                    return True
+            except (ConnectionRefusedError, OSError):
+                return False
+
+            return False
+
+        container_addr = self.container.get_ip()
+        if container_addr is None:
+            return False
+        LOGGER.debug('Trying to reach jenkins at container \'%s\' via '
+                     'the container\'s IP \'%s\' at port \'%d\'',
+                     self.container.container_name,
+                     container_addr, self.container.jenkins_port)
+        if not loop_until_timeout(ping_jenkins, 10):
+            LOGGER.error('Could not connect to jenkins')
+            return False
+
+        return True
+
+
+class SeleniumContainerSession():
+    def __init__(self, container):
+        self.container = container
+        self.driver = None
+        self.root_url = container.get_url()
+
+    def start(self):
+        options = webdriver.ChromeOptions()
+        options.add_argument('headless')
+        options.add_argument('no-sandbox')
+        options.add_argument('window-size=1200x600')
+
+        self.driver = webdriver.Chrome(chrome_options=options)
+        self.driver.get(self.root_url)
+
+        self.driver.get(self.root_url)
+        LOGGER.debug('Started a Selenium Session on %s', self.root_url)
+        return True
+
+
+def main():
+    DEFAULT_TIMEOUT = 120
+    DEFAULT_IMAGE_NAME = 'fuego-release'
+    DEFAULT_CONTAINER_NAME = 'fuego-release-container'
+    DEFAULT_INSTALL_SCRIPT = 'install.sh'
+    DEFAULT_START_SCRIPT = 'fuego-host-scripts/docker-start-container.sh'
+    DEFAULT_JENKINS_PORT = 8080
+
+    def execute_tests(timeout):
+        LOGGER.debug('Starting tests')
+
+        ctx_mapper = {
+            ShExpect: pexpect_session,
+            SeleniumCommand: selenium_session
+        }
+
+        tests_ok = True
+        for cmd in COMMANDS_TO_TEST:
+            for base_class, ctx in ctx_mapper.items():
+                if isinstance(cmd, base_class):
+                    if not cmd.exec(ctx):
+                        tests_ok = False
+                        break
+
+        if tests_ok:
+            LOGGER.debug('Tests finished.')
+
+        return tests_ok
+
+    parser = argparse.ArgumentParser()
+    parser.add_argument('working_dir', help='The working directory', type=str)
+    parser.add_argument('-s', '--install-script',
+                        help='The script that will be used to install the '
+                        'docker image. Defaults to \'{}\''
+                        .format(DEFAULT_INSTALL_SCRIPT),
+                        default=DEFAULT_INSTALL_SCRIPT,
+                        type=str)
+    parser.add_argument('-a', '--start-script',
+                        help='The script used to start the container. '
+                        'Defaults to \'{}\''
+                        .format(DEFAULT_START_SCRIPT),
+                        default=DEFAULT_START_SCRIPT,
+                        type=str)
+    parser.add_argument('-i', '--image-name', default=DEFAULT_IMAGE_NAME,
+                        help='The image name that should be used. '
+                        'Defaults to \'{}\''
+                        .format(DEFAULT_IMAGE_NAME), type=str)
+    parser.add_argument('-c', '--container-name',
+                        default=DEFAULT_CONTAINER_NAME,
+                        help='The container name that should be used for the '
+                        'test. Defaults to \'{}\''
+                        .format(DEFAULT_CONTAINER_NAME),
+                        type=str)
+    parser.add_argument('-t', '--timeout', help='The timeout value for '
+                        'commands. Defaults to {}'
+                        .format(DEFAULT_TIMEOUT),
+                        default=DEFAULT_TIMEOUT, type=int)
+    parser.add_argument('-j', '--jenkins-port',
+                        help='The port where the jenkins is running on the '
+                        'test container. Defaults to {}'
+                        .format(DEFAULT_JENKINS_PORT),
+                        default=DEFAULT_JENKINS_PORT, type=int)
+    args = parser.parse_args()
+
+    LOGGER.debug('Changing working dir to \'%s\'', args.working_dir)
+    os.chdir(args.working_dir)
+
+    container = FuegoContainer(args.install_script, args.image_name,
+                               args.container_name, args.jenkins_port)
+
+    pexpect_session = PexpectContainerSession(container, args.start_script,
+                                              args.timeout)
+    if not pexpect_session.start():
+        return 1
+
+    selenium_session = SeleniumContainerSession(container)
+    if not selenium_session.start():
+        return 1
+
+    COMMANDS_TO_TEST = [
+        ShExpect(
+            'echo $\'hello\n\n\nfrom\n\n\ncontainer\'',
+            r'hello\s+from\s+container'),
+        ShExpect(
+            'cat -ThisOptionDoesNotExists', expected_result=1),
+        ShExpect('ftc add-nodes docker'),
+        ShExpect(
+            'ftc list-nodes', r'Jenkins nodes in this system:\s*docker\s*.*'),
+        ShExpect('ftc add-jobs -b docker -p testplan_docker'),
+        ShExpect(
+            'ftc list-jobs', r'Jenkins jobs in this system:(\s*docker\..*)+'),
+        Visit(url=container.get_url()),
+        CheckText(_id='executors', text='docker'),
+        CheckText(_id='executors', text='master')
+    ]
+
+    if not execute_tests(args.timeout):
+        return 1
+
+    return 0
+
+
+if __name__ == '__main__':
+    sys.exit(main())
-- 
2.16.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Fuego] [PATCH 02/11] Mount fuego-rw/ro/core into the fuego-under-test container
  2018-03-07 19:54 [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest Guilherme Campos Camargo
  2018-03-07 19:54 ` [Fuego] [PATCH 01/11] Add fuego-release Functional test Guilherme Campos Camargo
@ 2018-03-07 19:54 ` Guilherme Campos Camargo
  2018-03-07 19:54 ` [Fuego] [PATCH 03/11] Use fuego-test branch to avoid install problems Guilherme Campos Camargo
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Guilherme Campos Camargo @ 2018-03-07 19:54 UTC (permalink / raw)
  To: fuego

This patch implements the necessary logic for mounting fuego-rw,
fuego-ro and fuego-core into fuego.

Given that the dockerd socket is shared between the host and the fuego
container, the mountpoints that are passed to the `docker create` call
need to be provided as full paths relative to the *host* (and not
relative to fuego, as would be expected if the docker daemons were
independent)

Signed-off-by: Guilherme Campos Camargo <guicc@profusion.mobi>
---
 engine/tests/Functional.fuegotest/test_run.py | 63 +++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

diff --git a/engine/tests/Functional.fuegotest/test_run.py b/engine/tests/Functional.fuegotest/test_run.py
index 96fcfb7..7eae056 100755
--- a/engine/tests/Functional.fuegotest/test_run.py
+++ b/engine/tests/Functional.fuegotest/test_run.py
@@ -173,12 +173,43 @@ class FuegoContainer:
         self.container = None
 
     def setup_docker(self):
+        def this_container_id():
+            with open('/proc/self/cgroup', 'rt') as f:
+                f_text = f.read()
+
+                if 'docker' not in f_text:
+                    return None
+
+                for c in self.docker_client.containers(quiet=True):
+                    if c['Id'] in f_text:
+                        return c['Id']
+
+                return None
+
+        def map_to_host(mounts, container_id):
+            host_mounts = self.docker_client.\
+                inspect_container(container_id)['Mounts']
+
+            for mount in mounts:
+                LOGGER.debug('  Trying to find %s mountpoint in the host', mount['source'])
+                for host_mount in host_mounts:
+                    if mount['source'].startswith(host_mount['Destination']):
+                        mount['source'] = mount['source'].\
+                            replace(host_mount['Destination'],
+                                    host_mount['Source'], 1)
+                        LOGGER.debug('    Found: %s', mount['source'])
+                        break
+                else:
+                    LOGGER.debug('    Not Found')
+                    mount['source'] = None
+
         cmd = './{} {}'.format(self.install_script, self.image_name)
         LOGGER.debug('Running \'%s\' to install the docker image. '
                      'This may take a while....', cmd)
         status = subprocess.call(cmd, shell=True)
         if status != 0:
             return None
+
         docker_client = docker.from_env()
         containers = docker_client.containers.list(
             all=True, filters={'name': self.container_name})
@@ -188,10 +219,42 @@ class FuegoContainer:
                 self.container_name)
             containers[0].remove(force=True)
 
+        mounts = [
+            {'source': os.path.abspath('./fuego-rw'),
+             'destination':  '/fuego-rw',
+             'readonly': False,
+             },
+            {'source': os.path.abspath('./fuego-ro'),
+             'destination':  '/fuego-ro',
+             'readonly': True,
+             },
+            {'source': os.path.abspath('../fuego-core'),
+             'destination':  '/fuego-core',
+             'readonly': True,
+             },
+        ]
+
+        our_id = this_container_id()
+
+        if our_id:
+            LOGGER.debug('Running inside the Docker container %s', our_id)
+            map_to_host(mounts, our_id)
+        else:
+            LOGGER.debug('Not running inside a Docker container')
+
+        LOGGER.debug('Creating container with the following mountpoints:')
+        LOGGER.debug('  %s', mounts)
+
         container = docker_client.containers.create(
             self.image_name,
             stdin_open=True, tty=True, network_mode='bridge',
+            mounts=[docker.types.Mount(m['destination'],
+                                       m['source'],
+                                       type='bind',
+                                       read_only=m['readonly'])
+                    for m in mounts],
             name=self.container_name, command='/bin/bash')
+
         LOGGER.debug('Container \'%s\' created', self.container_name)
         return container
 
-- 
2.16.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Fuego] [PATCH 03/11] Use fuego-test branch to avoid install problems
  2018-03-07 19:54 [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest Guilherme Campos Camargo
  2018-03-07 19:54 ` [Fuego] [PATCH 01/11] Add fuego-release Functional test Guilherme Campos Camargo
  2018-03-07 19:54 ` [Fuego] [PATCH 02/11] Mount fuego-rw/ro/core into the fuego-under-test container Guilherme Campos Camargo
@ 2018-03-07 19:54 ` Guilherme Campos Camargo
  2018-03-07 19:54 ` [Fuego] [PATCH 04/11] Increase wait_for_jenkins timeout from 10 to 60s Guilherme Campos Camargo
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Guilherme Campos Camargo @ 2018-03-07 19:54 UTC (permalink / raw)
  To: fuego

fuego:master/next are still using some debian apt-mirrors that seem to
be currently offline.

This commit should be reverted/changed in the future when we make sure
that the official fuego branches can be used with the test.

Signed-off-by: Guilherme Campos Camargo <guicc@profusion.mobi>
---
 engine/tests/Functional.fuegotest/spec.json | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/engine/tests/Functional.fuegotest/spec.json b/engine/tests/Functional.fuegotest/spec.json
index 42e8ac1..e026f6f 100644
--- a/engine/tests/Functional.fuegotest/spec.json
+++ b/engine/tests/Functional.fuegotest/spec.json
@@ -3,9 +3,9 @@
     "specs": {
         "default": {
             "FUEGOREPO":"https://bitbucket.org/profusionmobi/fuego",
-            "FUEGOBRANCH":"next",
+            "FUEGOBRANCH":"fuego-test",
             "FUEGOCOREREPO":"https://bitbucket.org/profusionmobi/fuego-core",
-            "FUEGOCOREBRANCH":"next"
+            "FUEGOCOREBRANCH":"fuego-test"
         }
     }
 }
-- 
2.16.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Fuego] [PATCH 04/11] Increase wait_for_jenkins timeout from 10 to 60s
  2018-03-07 19:54 [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest Guilherme Campos Camargo
                   ` (2 preceding siblings ...)
  2018-03-07 19:54 ` [Fuego] [PATCH 03/11] Use fuego-test branch to avoid install problems Guilherme Campos Camargo
@ 2018-03-07 19:54 ` Guilherme Campos Camargo
  2018-03-07 19:54 ` [Fuego] [PATCH 05/11] Print fuego repo/branch information during test build Guilherme Campos Camargo
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Guilherme Campos Camargo @ 2018-03-07 19:54 UTC (permalink / raw)
  To: fuego

Jenkins may take a little longer to be ready to receive commands in some
machines.

Signed-off-by: Guilherme Campos Camargo <guicc@profusion.mobi>
---
 engine/tests/Functional.fuegotest/test_run.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/engine/tests/Functional.fuegotest/test_run.py b/engine/tests/Functional.fuegotest/test_run.py
index 7eae056..e3fcb68 100755
--- a/engine/tests/Functional.fuegotest/test_run.py
+++ b/engine/tests/Functional.fuegotest/test_run.py
@@ -357,7 +357,7 @@ class PexpectContainerSession():
                      'the container\'s IP \'%s\' at port \'%d\'',
                      self.container.container_name,
                      container_addr, self.container.jenkins_port)
-        if not loop_until_timeout(ping_jenkins, 10):
+        if not loop_until_timeout(ping_jenkins, timeout=60):
             LOGGER.error('Could not connect to jenkins')
             return False
 
-- 
2.16.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Fuego] [PATCH 05/11] Print fuego repo/branch information during test build
  2018-03-07 19:54 [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest Guilherme Campos Camargo
                   ` (3 preceding siblings ...)
  2018-03-07 19:54 ` [Fuego] [PATCH 04/11] Increase wait_for_jenkins timeout from 10 to 60s Guilherme Campos Camargo
@ 2018-03-07 19:54 ` Guilherme Campos Camargo
  2018-03-07 19:54 ` [Fuego] [PATCH 06/11] Properly check install return code and abort in case of failure Guilherme Campos Camargo
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Guilherme Campos Camargo @ 2018-03-07 19:54 UTC (permalink / raw)
  To: fuego

Also remove --quiet from git clone

Signed-off-by: Guilherme Campos Camargo <guicc@profusion.mobi>
---
 engine/tests/Functional.fuegotest/fuego_test.sh | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/engine/tests/Functional.fuegotest/fuego_test.sh b/engine/tests/Functional.fuegotest/fuego_test.sh
index 192c15b..b4755bc 100755
--- a/engine/tests/Functional.fuegotest/fuego_test.sh
+++ b/engine/tests/Functional.fuegotest/fuego_test.sh
@@ -8,11 +8,16 @@ function test_build {
     if [ -d ${fuego_release_dir} ]; then
         rm -r ${fuego_release_dir}
     fi
-    git clone --quiet --depth 1 --single-branch \
+    echo "Cloning fuego from \
+        ${FUNCTIONAL_FUEGOTEST_FUEGOREPO}:${FUNCTIONAL_FUEGOTEST_FUEGOBRANCH}"
+    git clone --depth 1 --single-branch \
         --branch "${FUNCTIONAL_FUEGOTEST_FUEGOBRANCH}" \
         "${FUNCTIONAL_FUEGOTEST_FUEGOREPO}" \
         "${fuego_release_dir}/fuego"
-    git clone --quiet --depth 1 --single-branch \
+
+    echo "Cloning fuego-core from \
+        ${FUNCTIONAL_FUEGOTEST_FUEGOCOREREPO}:${FUNCTIONAL_FUEGOTEST_FUEGOCOREBRANCH}"
+    git clone --depth 1 --single-branch \
         --branch "${FUNCTIONAL_FUEGOTEST_FUEGOCOREBRANCH}" \
         "${FUNCTIONAL_FUEGOTEST_FUEGOCOREREPO}" \
         "${fuego_release_dir}/fuego-core"
-- 
2.16.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Fuego] [PATCH 06/11] Properly check install return code and abort in case of failure
  2018-03-07 19:54 [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest Guilherme Campos Camargo
                   ` (4 preceding siblings ...)
  2018-03-07 19:54 ` [Fuego] [PATCH 05/11] Print fuego repo/branch information during test build Guilherme Campos Camargo
@ 2018-03-07 19:54 ` Guilherme Campos Camargo
  2018-03-07 19:54 ` [Fuego] [PATCH 07/11] Allow the user to keep the container running after the test Guilherme Campos Camargo
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Guilherme Campos Camargo @ 2018-03-07 19:54 UTC (permalink / raw)
  To: fuego

A new method 'install()' has been added to 'FuegoContainer' and the all
the docker_setup steps have been moved from the class __init__() to this
new method.

This will allow the 'main' function to check if install has failed
simply by inspecting its return.

Signed-off-by: Guilherme Campos Camargo <guicc@profusion.mobi>
---
 engine/tests/Functional.fuegotest/test_run.py | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/engine/tests/Functional.fuegotest/test_run.py b/engine/tests/Functional.fuegotest/test_run.py
index e3fcb68..d6bec0c 100755
--- a/engine/tests/Functional.fuegotest/test_run.py
+++ b/engine/tests/Functional.fuegotest/test_run.py
@@ -160,14 +160,17 @@ class FuegoContainer:
         self.container_name = container_name
         self.jenkins_port = jenkins_port
 
-        self.docker_client = docker.APIClient()
-        self.container = self.setup_docker()
-
     def __del__(self):
         if self.container:
             LOGGER.debug('Removing Container')
             self.container.remove(force=True)
 
+    def install(self):
+        self.docker_client = docker.APIClient()
+        self.container = self.setup_docker()
+
+        return self.container
+
     def stop(self):
         self.container.remove(force=True)
         self.container = None
@@ -191,7 +194,8 @@ class FuegoContainer:
                 inspect_container(container_id)['Mounts']
 
             for mount in mounts:
-                LOGGER.debug('  Trying to find %s mountpoint in the host', mount['source'])
+                LOGGER.debug('  Trying to find %s mountpoint in the host',
+                             mount['source'])
                 for host_mount in host_mounts:
                     if mount['source'].startswith(host_mount['Destination']):
                         mount['source'] = mount['source'].\
@@ -207,6 +211,9 @@ class FuegoContainer:
         LOGGER.debug('Running \'%s\' to install the docker image. '
                      'This may take a while....', cmd)
         status = subprocess.call(cmd, shell=True)
+
+        LOGGER.debug('Install output code: %s', status)
+
         if status != 0:
             return None
 
@@ -453,6 +460,8 @@ def main():
 
     container = FuegoContainer(args.install_script, args.image_name,
                                args.container_name, args.jenkins_port)
+    if not container.install():
+        return 1
 
     pexpect_session = PexpectContainerSession(container, args.start_script,
                                               args.timeout)
-- 
2.16.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Fuego] [PATCH 07/11] Allow the user to keep the container running after the test
  2018-03-07 19:54 [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest Guilherme Campos Camargo
                   ` (5 preceding siblings ...)
  2018-03-07 19:54 ` [Fuego] [PATCH 06/11] Properly check install return code and abort in case of failure Guilherme Campos Camargo
@ 2018-03-07 19:54 ` Guilherme Campos Camargo
  2018-03-07 19:54 ` [Fuego] [PATCH 08/11] Add Back() Selenium Command Guilherme Campos Camargo
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Guilherme Campos Camargo @ 2018-03-07 19:54 UTC (permalink / raw)
  To: fuego

Through the `--remove-test-container` command line argument.

Signed-off-by: Guilherme Campos Camargo <guicc@profusion.mobi>
---
 engine/tests/Functional.fuegotest/test_run.py | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/engine/tests/Functional.fuegotest/test_run.py b/engine/tests/Functional.fuegotest/test_run.py
index d6bec0c..fa68858 100755
--- a/engine/tests/Functional.fuegotest/test_run.py
+++ b/engine/tests/Functional.fuegotest/test_run.py
@@ -154,16 +154,20 @@ class ShExpect():
 
 class FuegoContainer:
     def __init__(self, install_script, image_name, container_name,
-                 jenkins_port):
+                 jenkins_port, rm_after_test=True):
         self.install_script = install_script
         self.image_name = image_name
         self.container_name = container_name
         self.jenkins_port = jenkins_port
+        self.rm_after_test = rm_after_test
 
     def __del__(self):
         if self.container:
-            LOGGER.debug('Removing Container')
-            self.container.remove(force=True)
+            if self.rm_after_test:
+                LOGGER.debug('Removing Container')
+                self.container.remove(force=True)
+            else:
+                LOGGER.debug('Not Removing the test container')
 
     def install(self):
         self.docker_client = docker.APIClient()
@@ -453,13 +457,18 @@ def main():
                         'test container. Defaults to {}'
                         .format(DEFAULT_JENKINS_PORT),
                         default=DEFAULT_JENKINS_PORT, type=int)
+    parser.add_argument('--no-rm-container',
+                        help='Do not remove the container after tests are '
+                        'complete.',
+                        dest='rm_test_container', default=True, action='store_false')
     args = parser.parse_args()
 
     LOGGER.debug('Changing working dir to \'%s\'', args.working_dir)
     os.chdir(args.working_dir)
 
     container = FuegoContainer(args.install_script, args.image_name,
-                               args.container_name, args.jenkins_port)
+                               args.container_name, args.jenkins_port,
+                               rm_after_test=args.rm_test_container)
     if not container.install():
         return 1
 
-- 
2.16.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Fuego] [PATCH 08/11] Add Back() Selenium Command
  2018-03-07 19:54 [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest Guilherme Campos Camargo
                   ` (6 preceding siblings ...)
  2018-03-07 19:54 ` [Fuego] [PATCH 07/11] Allow the user to keep the container running after the test Guilherme Campos Camargo
@ 2018-03-07 19:54 ` Guilherme Campos Camargo
  2018-03-07 19:54 ` [Fuego] [PATCH 09/11] Add ClickLink selenium command Guilherme Campos Camargo
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Guilherme Campos Camargo @ 2018-03-07 19:54 UTC (permalink / raw)
  To: fuego

That will go one level back in the browser history.

Signed-off-by: Guilherme Campos Camargo <guicc@profusion.mobi>
---
 engine/tests/Functional.fuegotest/test_run.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/engine/tests/Functional.fuegotest/test_run.py b/engine/tests/Functional.fuegotest/test_run.py
index fa68858..851074f 100755
--- a/engine/tests/Functional.fuegotest/test_run.py
+++ b/engine/tests/Functional.fuegotest/test_run.py
@@ -97,6 +97,16 @@ class CheckText(SeleniumCommand):
         return result == self.expected_result
 
 
+class Back(SeleniumCommand):
+    def exec(self, selenium_ctx):
+        super().exec(selenium_ctx)
+
+        LOGGER.debug('  Going back')
+        self.driver.back()
+
+        return True
+
+
 class ShExpect():
     BASH_PATTERN = 'test_run_pr1:#'
     COMMAND_RESULT_PATTERN = re.compile('^([0-9]+)', re.M)
-- 
2.16.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Fuego] [PATCH 09/11] Add ClickLink selenium command
  2018-03-07 19:54 [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest Guilherme Campos Camargo
                   ` (7 preceding siblings ...)
  2018-03-07 19:54 ` [Fuego] [PATCH 08/11] Add Back() Selenium Command Guilherme Campos Camargo
@ 2018-03-07 19:54 ` Guilherme Campos Camargo
  2018-03-07 19:54 ` [Fuego] [PATCH 10/11] Include add-jobs, add-views and build-jobs tests Guilherme Campos Camargo
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 17+ messages in thread
From: Guilherme Campos Camargo @ 2018-03-07 19:54 UTC (permalink / raw)
  To: fuego

Clicks in the link that has the text passed in the argument `linktext`.
Returns False if no link containing `linktext` is found.

Signed-off-by: Guilherme Campos Camargo <guicc@profusion.mobi>
---
 engine/tests/Functional.fuegotest/test_run.py | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/engine/tests/Functional.fuegotest/test_run.py b/engine/tests/Functional.fuegotest/test_run.py
index 851074f..e03853b 100755
--- a/engine/tests/Functional.fuegotest/test_run.py
+++ b/engine/tests/Functional.fuegotest/test_run.py
@@ -13,6 +13,7 @@ import docker
 import pexpect
 import requests
 from selenium import webdriver
+import selenium.common.exceptions as selenium_exceptions
 
 LOGGER = logging.getLogger('test_run')
 STREAM_HANDLER = logging.StreamHandler()
@@ -97,6 +98,29 @@ class CheckText(SeleniumCommand):
         return result == self.expected_result
 
 
+class ClickLink(SeleniumCommand):
+    def __init__(self, linktext, expected_result=True):
+        self.linktext = linktext
+        self.expected_result = expected_result
+
+    def exec(self, selenium_ctx):
+        super().exec(selenium_ctx)
+
+        LOGGER.debug(
+            '  Searching for a link with the text \'%s\'', self.linktext)
+
+        try:
+            link = self.driver.find_element_by_partial_link_text(self.linktext)
+            link.click()
+            LOGGER.debug('  Link found and clicked')
+            result = True
+        except selenium_exceptions.NoSuchElementException:
+            LOGGER.error('  Link not found')
+            result = False
+
+        return result == self.expected_result
+
+
 class Back(SeleniumCommand):
     def exec(self, selenium_ctx):
         super().exec(selenium_ctx)
-- 
2.16.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Fuego] [PATCH 10/11] Include add-jobs, add-views and build-jobs tests
  2018-03-07 19:54 [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest Guilherme Campos Camargo
                   ` (8 preceding siblings ...)
  2018-03-07 19:54 ` [Fuego] [PATCH 09/11] Add ClickLink selenium command Guilherme Campos Camargo
@ 2018-03-07 19:54 ` Guilherme Campos Camargo
  2018-03-07 19:54 ` [Fuego] [PATCH 11/11] Write ok/fail on test report Guilherme Campos Camargo
  2018-03-08 21:32 ` [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest Tim.Bird
  11 siblings, 0 replies; 17+ messages in thread
From: Guilherme Campos Camargo @ 2018-03-07 19:54 UTC (permalink / raw)
  To: fuego

Those tests are using a combination of ShExpect and SeleniumHQ for
executing the command and checking if the website has responded
properly.

For now, SeleniumHQ is just being used for viewing the results on the
website, and not for sending commands. In other words, build-jobs is
being triggered through the command-line only, and not through the
Jenkins UI.

Signed-off-by: Guilherme Campos Camargo <guicc@profusion.mobi>
---
 engine/tests/Functional.fuegotest/test_run.py | 34 +++++++++++++++++----------
 1 file changed, 22 insertions(+), 12 deletions(-)

diff --git a/engine/tests/Functional.fuegotest/test_run.py b/engine/tests/Functional.fuegotest/test_run.py
index e03853b..09b3a95 100755
--- a/engine/tests/Functional.fuegotest/test_run.py
+++ b/engine/tests/Functional.fuegotest/test_run.py
@@ -516,20 +516,30 @@ def main():
         return 1
 
     COMMANDS_TO_TEST = [
-        ShExpect(
-            'echo $\'hello\n\n\nfrom\n\n\ncontainer\'',
-            r'hello\s+from\s+container'),
-        ShExpect(
-            'cat -ThisOptionDoesNotExists', expected_result=1),
-        ShExpect('ftc add-nodes docker'),
-        ShExpect(
-            'ftc list-nodes', r'Jenkins nodes in this system:\s*docker\s*.*'),
-        ShExpect('ftc add-jobs -b docker -p testplan_docker'),
-        ShExpect(
-            'ftc list-jobs', r'Jenkins jobs in this system:(\s*docker\..*)+'),
+        # Set Selenium Browser root
         Visit(url=container.get_url()),
+
+        # Add Nodes
+        ShExpect('ftc add-nodes docker'),
+        ShExpect('ftc list-nodes -q', r'.*docker.*'),
+        CheckText(_id='executors', text='master'),
         CheckText(_id='executors', text='docker'),
-        CheckText(_id='executors', text='master')
+
+        # Add Fuego TestPlan
+        ShExpect('ftc add-jobs -b docker -p testplan_fuego_tests'),
+        ShExpect('ftc list-jobs', r'.*docker\.testplan_fuego_tests\.batch.*'),
+
+        ClickLink(linktext='docker'),
+        CheckText(_id='projectstatus', text='docker.testplan_fuego_tests.batch'),
+        Back(),
+
+        # Install Views
+        ShExpect('ftc add-view batch .*.batch'),
+        CheckText(_id='projectstatus-tabBar', text='batch'),
+
+        # Start Tests
+        ShExpect('ftc build-jobs *.*.Functional.fuego_board_check'),
+        CheckText(_id='buildQueue', text='Functional.fuego_board_check'),
     ]
 
     if not execute_tests(args.timeout):
-- 
2.16.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Fuego] [PATCH 11/11] Write ok/fail on test report
  2018-03-07 19:54 [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest Guilherme Campos Camargo
                   ` (9 preceding siblings ...)
  2018-03-07 19:54 ` [Fuego] [PATCH 10/11] Include add-jobs, add-views and build-jobs tests Guilherme Campos Camargo
@ 2018-03-07 19:54 ` Guilherme Campos Camargo
  2018-03-08 21:32 ` [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest Tim.Bird
  11 siblings, 0 replies; 17+ messages in thread
From: Guilherme Campos Camargo @ 2018-03-07 19:54 UTC (permalink / raw)
  To: fuego

Remove the 'minimal test' that had been copied from an example test.

Signed-off-by: Guilherme Campos Camargo <guicc@profusion.mobi>
---
 engine/tests/Functional.fuegotest/fuego_test.sh | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/engine/tests/Functional.fuegotest/fuego_test.sh b/engine/tests/Functional.fuegotest/fuego_test.sh
index b4755bc..ee60c81 100755
--- a/engine/tests/Functional.fuegotest/fuego_test.sh
+++ b/engine/tests/Functional.fuegotest/fuego_test.sh
@@ -1,7 +1,5 @@
 #!/bin/bash
 
-set -e
-
 readonly fuego_release_dir=fuego-release
 
 function test_build {
@@ -26,9 +24,13 @@ function test_build {
 
 function test_run {
     sudo -n ${TEST_HOME}/test_run.py "${fuego_release_dir}/fuego"
-    report "echo ok 1 minimal test on target"
+    if [ "${?}" = 0 ]; then
+        report "echo fuego-test: ok"
+    else
+        report "echo fuego-test: fail"
+    fi
 }
 
 function test_processing {
-    log_compare "$TESTDIR" "1" "^ok" "p"
+    log_compare "$TESTDIR" "1" "ok$" "p"
 }
-- 
2.16.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest
  2018-03-07 19:54 [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest Guilherme Campos Camargo
                   ` (10 preceding siblings ...)
  2018-03-07 19:54 ` [Fuego] [PATCH 11/11] Write ok/fail on test report Guilherme Campos Camargo
@ 2018-03-08 21:32 ` Tim.Bird
  2018-03-08 22:20   ` Guilherme Camargo
  11 siblings, 1 reply; 17+ messages in thread
From: Tim.Bird @ 2018-03-08 21:32 UTC (permalink / raw)
  To: guicc, fuego

[-- Attachment #1: Type: text/plain, Size: 1667 bytes --]



> -----Original Message-----
> From: fuego-bounces@lists.linuxfoundation.org [mailto:fuego-
> bounces@lists.linuxfoundation.org] On Behalf Of Guilherme Campos
> Camargo
> Sent: Wednesday, March 07, 2018 11:55 AM
> To: fuego@lists.linuxfoundation.org
> Subject: [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest
> 
> Hello, Tim
> 
> Please see a few more commits that have been added to
> Functional.fuegotest.
> They include bug-fixes and some new tests (Shell and Selenium).
> 
> Not sure if you had the chance to take a look at my previous patches yet, but
> if not, please consider using these one instead.
> 
> There are many commits, but most of them are pretty small. Please feel
> free to ask me to squash some of them if you prefer.
> 
> To run these, you will need to checkout the `fuego-test` branch from
> Profusion's fuego and fuego-core forks and then simply use fuego as usual to
> add the fuego-test board and the Functional.fuegotest test.
> 
> In summary:
> 
> On host:
> git clone --branch fuego-test https://bitbucket.org/profusionmobi/fuego-
> core.git
> git clone --branch fuego-test https://bitbucket.org/profusionmobi/fuego.git
> cd fuego
> ./install.sh
> ./fuego-host-scripts/docker-remove-container.sh
> ./fuego-host-scripts/docker-create-container.sh
> ./fuego-host-scripts/docker-start-container.sh
> 

The build worked.

> In fuego:
> ftc add-nodes fuego-test
> ftc add-jobs -b fuego-test -t Functional.fuegotest

these worked.
 
> Then you will be able to start the test through Jenkins and see the results.
Running the test in jenkins resulted in the log that's attached.

 -- Tim

[-- Attachment #2: release-test-2018-03-08-log.txt --]
[-- Type: text/plain, Size: 4164 bytes --]

Started by user ^[[8mha:AAAAlh+LCAAAAAAAAP9b85aBtbiIQTGjNKU4P08vOT+vOD8nVc83PyU1x6OyILUoJzMv2y+/JJUBAhiZGBgqihhk0NSjKDWzXb3RdlLBUSYGJk8GtpzUvPSSDB8G5tKinBIGIZ+sxLJE/ZzEvHT94JKizLx0a6BxUmjGOUNodHsLgAzOEgYu/dLi1CL9vNKcHACFIKlWvwAAAA==^[[0manonymous
Building remotely on ^[[8mha:AAAAoB+LCAAAAAAAAP9b85aBtbiIQTGjNKU4P08vOT+vOD8nVc83PyU1x6OyILUoJzMv2y+/JJUBAhiZGBgqihhk0NSjKDWzXb3RdlLBUSYGJk8GtpzUvPSSDB8G5tKinBIGIZ+sxLJE/ZzEvHT94JKizLx0a6BxUmjGOUNodHsLgAyuEgYR/eT83ILSktQi/bTS1PR83ZLU4hIADoGZQ8kAAAA=^[[0mfuego-testFATAL: Failed to load the key: hudson.model.Job.serverCookie
^[[8mha:AAAAWB+LCAAAAAAAAP9b85aBtbiIQSmjNKU4P08vOT+vOD8nVc8DzHWtSE4tKMnMz/PLL0ldFVf2c+b/lb5MDAwVRQxSaBqcITRIIQMEMIIUFgAAckCEiWAAAAA=^[[0mjava.lang.Error: Failed to load the key: hudson.model.Job.serverCookie
	at jenkins.security.HexStringConfidentialKey.get(HexStringConfidentialKey.java:62)
	at hudson.model.Job.getCharacteristicEnvVars(Job.java:367)
	at hudson.model.Job.getEnvironment(Job.java:395)
	at hudson.model.AbstractProject.getEnvironment(AbstractProject.java:353)
	at hudson.model.Run.getEnvironment(Run.java:2264)
	at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:922)
	at hudson.model.AbstractBuild$AbstractBuildExecution.decideWorkspace(AbstractBuild.java:478)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:518)
	at hudson.model.Run.execute(Run.java:1728)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:98)
	at hudson.model.Executor.run(Executor.java:404)
Caused by: java.io.FileNotFoundException: /var/lib/jenkins/secrets/hudson.model.Job.serverCookie (Permission denied)
	at java.io.FileOutputStream.open(Native Method)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
	at jenkins.security.DefaultConfidentialStore.store(DefaultConfidentialStore.java:79)
	at jenkins.security.ConfidentialKey.store(ConfidentialKey.java:50)
	at jenkins.security.HexStringConfidentialKey.get(HexStringConfidentialKey.java:54)
	... 11 more
FATAL: Failed to load the key: hudson.model.Job.serverCookie
^[[8mha:AAAAWB+LCAAAAAAAAP9b85aBtbiIQSmjNKU4P08vOT+vOD8nVc8DzHWtSE4tKMnMz/PLL0ldFVf2c+b/lb5MDAwVRQxSaBqcITRIIQMEMIIUFgAAckCEiWAAAAA=^[[0mjava.lang.Error: Failed to load the key: hudson.model.Job.serverCookie
	at jenkins.security.HexStringConfidentialKey.get(HexStringConfidentialKey.java:62)
	at hudson.model.Job.getCharacteristicEnvVars(Job.java:367)
	at hudson.model.Job.getEnvironment(Job.java:395)
	at hudson.model.AbstractProject.getEnvironment(AbstractProject.java:353)
	at hudson.model.Run.getEnvironment(Run.java:2264)
	at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:922)
	at hudson.plugins.descriptionsetter.DescriptionSetterHelper.setDescription(DescriptionSetterHelper.java:53)
	at hudson.plugins.descriptionsetter.DescriptionSetterPublisher.perform(DescriptionSetterPublisher.java:70)
	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:720)
	at hudson.model.Build$BuildExecution.post2(Build.java:185)
	at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:665)
	at hudson.model.Run.execute(Run.java:1753)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:98)
	at hudson.model.Executor.run(Executor.java:404)
Caused by: java.io.FileNotFoundException: /var/lib/jenkins/secrets/hudson.model.Job.serverCookie (Permission denied)
	at java.io.FileOutputStream.open(Native Method)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
	at jenkins.security.DefaultConfidentialStore.store(DefaultConfidentialStore.java:79)
	at jenkins.security.ConfidentialKey.store(ConfidentialKey.java:50)
	at jenkins.security.HexStringConfidentialKey.get(HexStringConfidentialKey.java:54)
	... 16 more
Finished: FAILURE

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest
  2018-03-08 21:32 ` [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest Tim.Bird
@ 2018-03-08 22:20   ` Guilherme Camargo
  2018-03-09  0:00     ` Tim.Bird
  0 siblings, 1 reply; 17+ messages in thread
From: Guilherme Camargo @ 2018-03-08 22:20 UTC (permalink / raw)
  To: Bird, Timothy; +Cc: fuego

[-- Attachment #1: Type: text/plain, Size: 2516 bytes --]

​Tim, can you please try to add `--privileged` to the `docker create`​ call
on fuego-host-scripts/docker-create-container.sh ? This should not be the
final fix, it's just for testing.

```

sudo docker create -it --name ${DOCKERCONTAINER} \
    --privileged \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v /boot:/boot:ro \
    -v $DIR/../fuego-rw:/fuego-rw \
    -v $DIR/../fuego-ro:/fuego-ro:ro \
    -v $DIR/../../fuego-core:/fuego-core:ro \
    -e http_proxy=${http_proxy} \
    -e https_proxy=${https_proxy:-$http_proxy} \
    --net="host" ${DOCKERIMAGE} || \
    echo "Could not create fuego-container. See error messages."

```


Thanks


On Thu, Mar 8, 2018 at 6:32 PM, <Tim.Bird@sony.com> wrote:

>
>
> > -----Original Message-----
> > From: fuego-bounces@lists.linuxfoundation.org [mailto:fuego-
> > bounces@lists.linuxfoundation.org] On Behalf Of Guilherme Campos
> > Camargo
> > Sent: Wednesday, March 07, 2018 11:55 AM
> > To: fuego@lists.linuxfoundation.org
> > Subject: [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest
> >
> > Hello, Tim
> >
> > Please see a few more commits that have been added to
> > Functional.fuegotest.
> > They include bug-fixes and some new tests (Shell and Selenium).
> >
> > Not sure if you had the chance to take a look at my previous patches
> yet, but
> > if not, please consider using these one instead.
> >
> > There are many commits, but most of them are pretty small. Please feel
> > free to ask me to squash some of them if you prefer.
> >
> > To run these, you will need to checkout the `fuego-test` branch from
> > Profusion's fuego and fuego-core forks and then simply use fuego as
> usual to
> > add the fuego-test board and the Functional.fuegotest test.
> >
> > In summary:
> >
> > On host:
> > git clone --branch fuego-test https://bitbucket.org/profusionmobi/fuego-
> > core.git
> > git clone --branch fuego-test https://bitbucket.org/
> profusionmobi/fuego.git
> > cd fuego
> > ./install.sh
> > ./fuego-host-scripts/docker-remove-container.sh
> > ./fuego-host-scripts/docker-create-container.sh
> > ./fuego-host-scripts/docker-start-container.sh
> >
>
> The build worked.
>
> > In fuego:
> > ftc add-nodes fuego-test
> > ftc add-jobs -b fuego-test -t Functional.fuegotest
>
> these worked.
>
> > Then you will be able to start the test through Jenkins and see the
> results.
> Running the test in jenkins resulted in the log that's attached.
>
>  -- Tim
>

[-- Attachment #2: Type: text/html, Size: 4651 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest
  2018-03-08 22:20   ` Guilherme Camargo
@ 2018-03-09  0:00     ` Tim.Bird
  2018-03-09  0:51       ` Tim.Bird
  0 siblings, 1 reply; 17+ messages in thread
From: Tim.Bird @ 2018-03-09  0:00 UTC (permalink / raw)
  To: guicc; +Cc: fuego

Same behavior.
 -- Tim


> -----Original Message-----
> From: fuego-bounces@lists.linuxfoundation.org [mailto:fuego-
> bounces@lists.linuxfoundation.org] On Behalf Of Guilherme Camargo
> Sent: Thursday, March 08, 2018 2:20 PM
> To: Bird, Timothy <Tim.Bird@sony.com>
> Cc: fuego@lists.linuxfoundation.org
> Subject: Re: [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest
> 
> ​Tim, can you please try to add `--privileged` to the `docker create`​ call on
> fuego-host-scripts/docker-create-container.sh ? This should not be the final
> fix, it's just for testing.
> 
> ```
> 
> sudo docker create -it --name ${DOCKERCONTAINER} \
>     --privileged \
>     -v /var/run/docker.sock:/var/run/docker.sock \
>     -v /boot:/boot:ro \
>     -v $DIR/../fuego-rw:/fuego-rw \
>     -v $DIR/../fuego-ro:/fuego-ro:ro \
>     -v $DIR/../../fuego-core:/fuego-core:ro \
>     -e http_proxy=${http_proxy} \
>     -e https_proxy=${https_proxy:-$http_proxy} \
>     --net="host" ${DOCKERIMAGE} || \
>     echo "Could not create fuego-container. See error messages."
> 
> ```
> 
> 
> Thanks
> 
> 
> On Thu, Mar 8, 2018 at 6:32 PM, <Tim.Bird@sony.com
> <mailto:Tim.Bird@sony.com> > wrote:
> 
> 
> 
> 
> 	> -----Original Message-----
> 	> From: fuego-bounces@lists.linuxfoundation.org <mailto:fuego-
> bounces@lists.linuxfoundation.org>  [mailto:fuego- <mailto:fuego->
> 	> bounces@lists.linuxfoundation.org
> <mailto:bounces@lists.linuxfoundation.org> ] On Behalf Of Guilherme
> Campos
> 	> Camargo
> 	> Sent: Wednesday, March 07, 2018 11:55 AM
> 	> To: fuego@lists.linuxfoundation.org
> <mailto:fuego@lists.linuxfoundation.org>
> 	> Subject: [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest
> 	>
> 	> Hello, Tim
> 	>
> 	> Please see a few more commits that have been added to
> 	> Functional.fuegotest.
> 	> They include bug-fixes and some new tests (Shell and Selenium).
> 	>
> 	> Not sure if you had the chance to take a look at my previous
> patches yet, but
> 	> if not, please consider using these one instead.
> 	>
> 	> There are many commits, but most of them are pretty small. Please
> feel
> 	> free to ask me to squash some of them if you prefer.
> 	>
> 	> To run these, you will need to checkout the `fuego-test` branch
> from
> 	> Profusion's fuego and fuego-core forks and then simply use fuego
> as usual to
> 	> add the fuego-test board and the Functional.fuegotest test.
> 	>
> 	> In summary:
> 	>
> 	> On host:
> 	> git clone --branch fuego-test
> https://bitbucket.org/profusionmobi/fuego-
> <https://bitbucket.org/profusionmobi/fuego->
> 	> core.git
> 	> git clone --branch fuego-test
> https://bitbucket.org/profusionmobi/fuego.git
> <https://bitbucket.org/profusionmobi/fuego.git>
> 	> cd fuego
> 	> ./install.sh
> 	> ./fuego-host-scripts/docker-remove-container.sh
> 	> ./fuego-host-scripts/docker-create-container.sh
> 	> ./fuego-host-scripts/docker-start-container.sh
> 	>
> 
> 
> 	The build worked.
> 
> 	> In fuego:
> 	> ftc add-nodes fuego-test
> 	> ftc add-jobs -b fuego-test -t Functional.fuegotest
> 
> 	these worked.
> 
> 	> Then you will be able to start the test through Jenkins and see the
> results.
> 	Running the test in jenkins resulted in the log that's attached.
> 
> 	 -- Tim
> 
> 


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest
  2018-03-09  0:00     ` Tim.Bird
@ 2018-03-09  0:51       ` Tim.Bird
  2018-03-09 19:29         ` Guilherme Camargo
  0 siblings, 1 reply; 17+ messages in thread
From: Tim.Bird @ 2018-03-09  0:51 UTC (permalink / raw)
  To: Tim.Bird, guicc; +Cc: fuego

I just tried to everything on Ubuntu 16.04, using docker version 1.13.1,
and I get the same problem.

When I exit the container, and try to restart it, Jenkins fails to start, and the
log says:
java.io.FileNotFoundException: /var/cache/jenkins/war/META-INF/MANIFEST.MF

The file is there, owned by jenkins.jenkins.

Here is more information:
jenkins@timdesk:/var/cache/jenkins$ ls -la
ls: cannot access war: Permission denied
total 8
drwxr-x---  4 jenkins jenkins 4096 Mar  9 00:37 .
drwxr-xr-x 20 root   root    4096 Mar  9 00:37 ..
d?????????  ? ?        ?           ?                ? war
jenkins@timdesk:/var/cache/jenkins$l id
uid=1000(jenkins) gid=1000(jenkins) groups=1000(jenkins)
------

So, we've still got a permission problem in here somewhere.
 -- Tim

> -----Original Message-----
> From: Tim.Bird@sony.com
> 
> Same behavior.
>  -- Tim
> 
> 
> > -----Original Message-----
> > From: fuego-bounces@lists.linuxfoundation.org [mailto:fuego-
> > bounces@lists.linuxfoundation.org] On Behalf Of Guilherme Camargo
> > Sent: Thursday, March 08, 2018 2:20 PM
> > To: Bird, Timothy <Tim.Bird@sony.com>
> > Cc: fuego@lists.linuxfoundation.org
> > Subject: Re: [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest
> >
> > ​Tim, can you please try to add `--privileged` to the `docker create`​ call on
> > fuego-host-scripts/docker-create-container.sh ? This should not be the
> final
> > fix, it's just for testing.
> >
> > ```
> >
> > sudo docker create -it --name ${DOCKERCONTAINER} \
> >     --privileged \
> >     -v /var/run/docker.sock:/var/run/docker.sock \
> >     -v /boot:/boot:ro \
> >     -v $DIR/../fuego-rw:/fuego-rw \
> >     -v $DIR/../fuego-ro:/fuego-ro:ro \
> >     -v $DIR/../../fuego-core:/fuego-core:ro \
> >     -e http_proxy=${http_proxy} \
> >     -e https_proxy=${https_proxy:-$http_proxy} \
> >     --net="host" ${DOCKERIMAGE} || \
> >     echo "Could not create fuego-container. See error messages."
> >
> > ```
> >
> >
> > Thanks
> >
> >
> > On Thu, Mar 8, 2018 at 6:32 PM, <Tim.Bird@sony.com
> > <mailto:Tim.Bird@sony.com> > wrote:
> >
> >
> >
> >
> > 	> -----Original Message-----
> > 	> From: fuego-bounces@lists.linuxfoundation.org <mailto:fuego-
> > bounces@lists.linuxfoundation.org>  [mailto:fuego- <mailto:fuego->
> > 	> bounces@lists.linuxfoundation.org
> > <mailto:bounces@lists.linuxfoundation.org> ] On Behalf Of Guilherme
> > Campos
> > 	> Camargo
> > 	> Sent: Wednesday, March 07, 2018 11:55 AM
> > 	> To: fuego@lists.linuxfoundation.org
> > <mailto:fuego@lists.linuxfoundation.org>
> > 	> Subject: [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest
> > 	>
> > 	> Hello, Tim
> > 	>
> > 	> Please see a few more commits that have been added to
> > 	> Functional.fuegotest.
> > 	> They include bug-fixes and some new tests (Shell and Selenium).
> > 	>
> > 	> Not sure if you had the chance to take a look at my previous
> > patches yet, but
> > 	> if not, please consider using these one instead.
> > 	>
> > 	> There are many commits, but most of them are pretty small. Please
> > feel
> > 	> free to ask me to squash some of them if you prefer.
> > 	>
> > 	> To run these, you will need to checkout the `fuego-test` branch
> > from
> > 	> Profusion's fuego and fuego-core forks and then simply use fuego
> > as usual to
> > 	> add the fuego-test board and the Functional.fuegotest test.
> > 	>
> > 	> In summary:
> > 	>
> > 	> On host:
> > 	> git clone --branch fuego-test
> > https://bitbucket.org/profusionmobi/fuego-
> > <https://bitbucket.org/profusionmobi/fuego->
> > 	> core.git
> > 	> git clone --branch fuego-test
> > https://bitbucket.org/profusionmobi/fuego.git
> > <https://bitbucket.org/profusionmobi/fuego.git>
> > 	> cd fuego
> > 	> ./install.sh
> > 	> ./fuego-host-scripts/docker-remove-container.sh
> > 	> ./fuego-host-scripts/docker-create-container.sh
> > 	> ./fuego-host-scripts/docker-start-container.sh
> > 	>
> >
> >
> > 	The build worked.
> >
> > 	> In fuego:
> > 	> ftc add-nodes fuego-test
> > 	> ftc add-jobs -b fuego-test -t Functional.fuegotest
> >
> > 	these worked.
> >
> > 	> Then you will be able to start the test through Jenkins and see the
> > results.
> > 	Running the test in jenkins resulted in the log that's attached.
> >
> > 	 -- Tim
> >
> >
> 
> _______________________________________________
> Fuego mailing list
> Fuego@lists.linuxfoundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/fuego

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest
  2018-03-09  0:51       ` Tim.Bird
@ 2018-03-09 19:29         ` Guilherme Camargo
  0 siblings, 0 replies; 17+ messages in thread
From: Guilherme Camargo @ 2018-03-09 19:29 UTC (permalink / raw)
  To: Bird, Timothy; +Cc: fuego


[-- Attachment #1.1: Type: text/plain, Size: 6684 bytes --]

​Hello, Tim, hope everything is going well.

Can you please give it a couple more tries by checking out the two
new branches that I've just pushed to our fuego repo?

You can just fetch them, checkout and run, because
we haven't force pushed anything since yesterday.

They have one commit each (above fuego-test branch),
with a potential fix to the problem.


The repo/branches are these ones:

* https://bitbucket.org/profusionmobi/fuego/branch/chown-all?dest=fuego-test

  git fetch && git checkout chown-all

  On this patch we're just using `chown -R --from` to chown all jenkins
  files that may still exist outside of the directories that we were
chowning
  so far.

  Please Try This One First. And if it works, great. If not, please
  try the next branch (below).


*
https://bitbucket.org/profusionmobi/fuego/branch/jenkins-user-on-build?dest=fuego-test

  git fetch && git checkout jenkins-user-on-build

  This patch is almost a 'clean revert' of the patch that moved the jenkins
uid
  mapping to the entrypoint. We're just setting the correct jenkins id
during
  docker build, by passing uid/gid through the docker-build-image.sh script
and
  reading them through the Dockerfile.

  This one should probably solve the issue, given that no ownership will
need to
  be changed, since Jenkins starts for the first time with the correct user
already.


Please just make sure to run a `git clean -dxf` in the repo before running,
to remove anything that jenkins might have written to fuego-rw.


I'm also attaching the patches, for you to apply them directly if you
prefer.



Thank you very much



On Thu, Mar 8, 2018 at 9:51 PM, <Tim.Bird@sony.com> wrote:

> I just tried to everything on Ubuntu 16.04, using docker version 1.13.1,
> and I get the same problem.
>
> When I exit the container, and try to restart it, Jenkins fails to start,
> and the
> log says:
> java.io.FileNotFoundException: /var/cache/jenkins/war/META-INF/MANIFEST.MF
>
> The file is there, owned by jenkins.jenkins.
>
> Here is more information:
> jenkins@timdesk:/var/cache/jenkins$ ls -la
> ls: cannot access war: Permission denied
> total 8
> drwxr-x---  4 jenkins jenkins 4096 Mar  9 00:37 .
> drwxr-xr-x 20 root   root    4096 Mar  9 00:37 ..
> d?????????  ? ?        ?           ?                ? war
> jenkins@timdesk:/var/cache/jenkins$l id
> uid=1000(jenkins) gid=1000(jenkins) groups=1000(jenkins)
> ------
>
> So, we've still got a permission problem in here somewhere.
>  -- Tim
>
> > -----Original Message-----
> > From: Tim.Bird@sony.com
> >
> > Same behavior.
> >  -- Tim
> >
> >
> > > -----Original Message-----
> > > From: fuego-bounces@lists.linuxfoundation.org [mailto:fuego-
> > > bounces@lists.linuxfoundation.org] On Behalf Of Guilherme Camargo
> > > Sent: Thursday, March 08, 2018 2:20 PM
> > > To: Bird, Timothy <Tim.Bird@sony.com>
> > > Cc: fuego@lists.linuxfoundation.org
> > > Subject: Re: [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest
> > >
> > > ​Tim, can you please try to add `--privileged` to the `docker create`​
> call on
> > > fuego-host-scripts/docker-create-container.sh ? This should not be the
> > final
> > > fix, it's just for testing.
> > >
> > > ```
> > >
> > > sudo docker create -it --name ${DOCKERCONTAINER} \
> > >     --privileged \
> > >     -v /var/run/docker.sock:/var/run/docker.sock \
> > >     -v /boot:/boot:ro \
> > >     -v $DIR/../fuego-rw:/fuego-rw \
> > >     -v $DIR/../fuego-ro:/fuego-ro:ro \
> > >     -v $DIR/../../fuego-core:/fuego-core:ro \
> > >     -e http_proxy=${http_proxy} \
> > >     -e https_proxy=${https_proxy:-$http_proxy} \
> > >     --net="host" ${DOCKERIMAGE} || \
> > >     echo "Could not create fuego-container. See error messages."
> > >
> > > ```
> > >
> > >
> > > Thanks
> > >
> > >
> > > On Thu, Mar 8, 2018 at 6:32 PM, <Tim.Bird@sony.com
> > > <mailto:Tim.Bird@sony.com> > wrote:
> > >
> > >
> > >
> > >
> > >     > -----Original Message-----
> > >     > From: fuego-bounces@lists.linuxfoundation.org <mailto:fuego-
> > > bounces@lists.linuxfoundation.org>  [mailto:fuego- <mailto:fuego->
> > >     > bounces@lists.linuxfoundation.org
> > > <mailto:bounces@lists.linuxfoundation.org> ] On Behalf Of Guilherme
> > > Campos
> > >     > Camargo
> > >     > Sent: Wednesday, March 07, 2018 11:55 AM
> > >     > To: fuego@lists.linuxfoundation.org
> > > <mailto:fuego@lists.linuxfoundation.org>
> > >     > Subject: [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest
> > >     >
> > >     > Hello, Tim
> > >     >
> > >     > Please see a few more commits that have been added to
> > >     > Functional.fuegotest.
> > >     > They include bug-fixes and some new tests (Shell and Selenium).
> > >     >
> > >     > Not sure if you had the chance to take a look at my previous
> > > patches yet, but
> > >     > if not, please consider using these one instead.
> > >     >
> > >     > There are many commits, but most of them are pretty small. Please
> > > feel
> > >     > free to ask me to squash some of them if you prefer.
> > >     >
> > >     > To run these, you will need to checkout the `fuego-test` branch
> > > from
> > >     > Profusion's fuego and fuego-core forks and then simply use fuego
> > > as usual to
> > >     > add the fuego-test board and the Functional.fuegotest test.
> > >     >
> > >     > In summary:
> > >     >
> > >     > On host:
> > >     > git clone --branch fuego-test
> > > https://bitbucket.org/profusionmobi/fuego-
> > > <https://bitbucket.org/profusionmobi/fuego->
> > >     > core.git
> > >     > git clone --branch fuego-test
> > > https://bitbucket.org/profusionmobi/fuego.git
> > > <https://bitbucket.org/profusionmobi/fuego.git>
> > >     > cd fuego
> > >     > ./install.sh
> > >     > ./fuego-host-scripts/docker-remove-container.sh
> > >     > ./fuego-host-scripts/docker-create-container.sh
> > >     > ./fuego-host-scripts/docker-start-container.sh
> > >     >
> > >
> > >
> > >     The build worked.
> > >
> > >     > In fuego:
> > >     > ftc add-nodes fuego-test
> > >     > ftc add-jobs -b fuego-test -t Functional.fuegotest
> > >
> > >     these worked.
> > >
> > >     > Then you will be able to start the test through Jenkins and see
> the
> > > results.
> > >     Running the test in jenkins resulted in the log that's attached.
> > >
> > >      -- Tim
> > >
> > >
> >
> > _______________________________________________
> > Fuego mailing list
> > Fuego@lists.linuxfoundation.org
> > https://lists.linuxfoundation.org/mailman/listinfo/fuego
>

[-- Attachment #1.2: Type: text/html, Size: 16366 bytes --]

[-- Attachment #2: chown_jenkins.patch --]
[-- Type: text/x-patch, Size: 1684 bytes --]

diff --git a/setup/entrypoint.sh b/setup/entrypoint.sh
index 21017db..1e25769 100755
--- a/setup/entrypoint.sh
+++ b/setup/entrypoint.sh
@@ -19,18 +19,26 @@ function map_jenkins_uid_to_host() {
         return 0
     fi
 
-    DJUID=${docker_jenkins_uid}
-    DJGID=${docker_jenkins_gid}
+    old_jenkins_uid=$(id -u jenkins)
+    old_jenkins_gid=$(id -g jenkins)
+    new_jenkins_uid=${docker_jenkins_uid}
+    new_jenkins_gid=${docker_jenkins_gid}
 
-    echo "Remapping Fuego's jenkins uid=$(id -u jenkins) to uid=${DJUID}..."
+    echo "Remapping Fuego's jenkins uid=$(id -u jenkins) to uid=${new_jenkins_uid}..."
+    usermod -u "${new_jenkins_uid}" jenkins
 
-    usermod -u "${DJUID}" jenkins
-    groupmod -g "${DJGID}" jenkins
-    chown -R "${DJUID}":"${DJGID}" \
+    echo "Remapping Fuego's jenkins gid=$(id -g jenkins) to gid=${new_jenkins_gid}..."
+    groupmod -g "${new_jenkins_gid}" jenkins
+
+    echo "Reowning jenkins' files"
+    chown -R --silent jenkins:jenkins \
         /var/lib/jenkins /var/cache/jenkins /var/log/jenkins /fuego-rw
+    chown -R --silent --from ${old_jenkins_uid} jenkins /
+    chown -R --silent --from :${old_jenkins_gid} :jenkins /
 }
 
 service jenkins stop >> /dev/null
+sleep 5
 map_jenkins_uid_to_host
 set_jenkins_port
 service jenkins start
diff --git a/setup/jenkins/plugins/install.sh b/setup/jenkins/plugins/install.sh
index 37e8948..944ce7b 100755
--- a/setup/jenkins/plugins/install.sh
+++ b/setup/jenkins/plugins/install.sh
@@ -41,3 +41,5 @@ ln -s /fuego-rw/logs "$JENKINS_HOME/userContent/fuego.logs"
 ln -s /fuego-core/engine/scripts/ftc /usr/local/bin/
 
 chown -R jenkins:jenkins "$JENKINS_HOME/"
+
+service jenkins stop

[-- Attachment #3: jenkins_user_on_build.patch --]
[-- Type: text/x-patch, Size: 1441 bytes --]

diff --git a/Dockerfile b/Dockerfile
index 42b2fc8..3334a54 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -101,7 +101,14 @@ ARG JENKINS_SHA=bfc226aabe2bb089623772950c4cc13aee613af1
 ARG JENKINS_URL=https://pkg.jenkins.io/debian-stable/binary/jenkins_${JENKINS_VERSION}_all.deb
 ENV JENKINS_HOME=/var/lib/jenkins
 
-RUN curl -L -O ${JENKINS_URL} && \
+ARG uid=1009
+ARG gid=${uid}
+
+RUN echo "Creating Jenkins user/group with uid:gid ${uid}:${gid}"
+
+RUN groupadd -g ${gid} jenkins && \
+    useradd -l -m -d "${JENKINS_HOME}" -u ${uid} -g ${gid} -G sudo -s /bin/bash jenkins && \
+    curl -L -O ${JENKINS_URL} && \
     echo "${JENKINS_SHA} jenkins_${JENKINS_VERSION}_all.deb" | sha1sum -c - && \
     dpkg -i jenkins_${JENKINS_VERSION}_all.deb && \
     rm jenkins_${JENKINS_VERSION}_all.deb
diff --git a/fuego-host-scripts/docker-build-image.sh b/fuego-host-scripts/docker-build-image.sh
index d276ee0..02a4069 100755
--- a/fuego-host-scripts/docker-build-image.sh
+++ b/fuego-host-scripts/docker-build-image.sh
@@ -2,6 +2,16 @@
 # $1 - name for the docker image (default: fuego)
 DOCKERIMAGE=${1:-fuego}
 
+if [ "${UID}" == "0" ]; then
+	uid=$(id -u "${SUDO_USER}")
+	gid=$(id -g "${SUDO_USER}")
+else
+	uid="${UID}"
+	gid=$(id -g "${USER}")
+fi
+
 sudo docker build -t ${DOCKERIMAGE} \
+    --build-arg uid=${uid} \
+    --build-arg gid=${gid} \
     --build-arg http_proxy=${http_proxy} \
     --build-arg https_proxy=${https_proxy} .

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2018-03-09 19:29 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-07 19:54 [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest Guilherme Campos Camargo
2018-03-07 19:54 ` [Fuego] [PATCH 01/11] Add fuego-release Functional test Guilherme Campos Camargo
2018-03-07 19:54 ` [Fuego] [PATCH 02/11] Mount fuego-rw/ro/core into the fuego-under-test container Guilherme Campos Camargo
2018-03-07 19:54 ` [Fuego] [PATCH 03/11] Use fuego-test branch to avoid install problems Guilherme Campos Camargo
2018-03-07 19:54 ` [Fuego] [PATCH 04/11] Increase wait_for_jenkins timeout from 10 to 60s Guilherme Campos Camargo
2018-03-07 19:54 ` [Fuego] [PATCH 05/11] Print fuego repo/branch information during test build Guilherme Campos Camargo
2018-03-07 19:54 ` [Fuego] [PATCH 06/11] Properly check install return code and abort in case of failure Guilherme Campos Camargo
2018-03-07 19:54 ` [Fuego] [PATCH 07/11] Allow the user to keep the container running after the test Guilherme Campos Camargo
2018-03-07 19:54 ` [Fuego] [PATCH 08/11] Add Back() Selenium Command Guilherme Campos Camargo
2018-03-07 19:54 ` [Fuego] [PATCH 09/11] Add ClickLink selenium command Guilherme Campos Camargo
2018-03-07 19:54 ` [Fuego] [PATCH 10/11] Include add-jobs, add-views and build-jobs tests Guilherme Campos Camargo
2018-03-07 19:54 ` [Fuego] [PATCH 11/11] Write ok/fail on test report Guilherme Campos Camargo
2018-03-08 21:32 ` [Fuego] [PATCH 00/11] Add Fuego Functional.fuegotest Tim.Bird
2018-03-08 22:20   ` Guilherme Camargo
2018-03-09  0:00     ` Tim.Bird
2018-03-09  0:51       ` Tim.Bird
2018-03-09 19:29         ` Guilherme Camargo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.