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

Commit

Permalink
Merge pull request #5877 from ManageIQ/revert-5772-dockerbot-collecto…
Browse files Browse the repository at this point in the history
…nly-step-hack

Revert "[1LP][RFR] Dockerbot collectonly step hack"
  • Loading branch information
mshriver authored Nov 17, 2017
2 parents ae970b3 + 4b44765 commit 310388b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 75 deletions.
1 change: 0 additions & 1 deletion cfme/scripting/sprout.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def checkout(appliances, timeout, provision_timeout, group, version, date, desc,
sr = SproutProvisioningRequest(group=group, count=appliances, version=version, date=date,
lease_time=timeout, provision_timeout=provision_timeout,
desc=desc, cpu=override_cpu, ram=override_ram, provider=provider)
print(sr)
sm = SproutManager()

def exit_gracefully(signum, frame):
Expand Down
4 changes: 1 addition & 3 deletions cfme/test_framework/appliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

def pytest_addoption(parser):
parser.addoption('--dummy-appliance', action='store_true')
parser.addoption('--dummy-appliance-version', default=attr.NOTHING)


def appliances_from_cli(cli_appliances):
Expand All @@ -38,8 +37,7 @@ def pytest_configure(config):
if stack.top:
appliances = [stack.top]
elif config.getoption('--dummy-appliance'):
appliances = [DummyAppliance(
version=config.getoption('--dummy-appliance-version'))]
appliances = [DummyAppliance()]
reporter.write_line('Retrieved Dummy Appliance', red=True)
elif config.option.appliances:
appliances = appliances_from_cli(config.option.appliances)
Expand Down
21 changes: 10 additions & 11 deletions cfme/test_framework/sprout/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import os
import requests

import attr

from cfme.utils.version import get_stream
from cfme.utils.appliance import current_appliance, IPAppliance
from cfme.utils.conf import credentials, env
Expand All @@ -21,22 +19,23 @@ class AuthException(SproutException):
pass


@attr.s
class APIMethodCall(object):
_client = attr.ib()
_method_name = attr.ib()
def __init__(self, client, method_name):
self._client = client
self._method_name = method_name

def __call__(self, *args, **kwargs):
return self._client.call_method(self._method_name, *args, **kwargs)


@attr.s
class SproutClient(object):
_proto = attr.ib(default="http")
_host = attr.ib(default="localhost")
_port = attr.ib(default=8000)
_entry = attr.ib(default="appliances/api")
_auth = attr.ib(default=None)
def __init__(
self, protocol="http", host="localhost", port=8000, entry="appliances/api", auth=None):
self._proto = protocol
self._host = host
self._port = port
self._entry = entry
self._auth = auth

@property
def api_entry(self):
Expand Down
26 changes: 2 additions & 24 deletions cfme/utils/appliance/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from time import sleep, time
from urlparse import ParseResult, urlparse

import six
import attr

import dateutil.parser
Expand All @@ -36,6 +35,7 @@
from cfme.utils.ssh import SSHTail
from cfme.utils.version import Version, get_stream, pick
from cfme.utils.wait import wait_for, TimedOutError

from .db import ApplianceDB
from .implementations.ui import ViaUI
from .implementations.rest import ViaREST
Expand Down Expand Up @@ -2629,33 +2629,12 @@ def load_appliances(appliance_list, global_kwargs):
return result


def _version_for_version_or_stream(version_or_stream, sprout_client=None):
if version_or_stream is attr.NOTHING:
return attr.fields(DummyAppliance).version.default
if isinstance(version_or_stream, Version):
return version_or_stream

assert isinstance(version_or_stream, six.string_types), version_or_stream

from cfme.test_framework.sprout.client import SproutClient
sprout_client = SproutClient.from_config() if sprout_client is None else sprout_client

if version_or_stream[0].isdigit(): # presume streams start with non-number
return Version(version_or_stream)
for version_str in sprout_client.available_cfme_versions():
version = Version(version_str)
if version.stream() == version_or_stream:
return version

raise LookupError(version_or_stream)


@attr.s
class DummyAppliance(object):
"""a dummy with minimal attribute set"""
address = '0.0.0.0'
browser_steal = False
version = attr.ib(default=Version('5.8.0'), convert=_version_for_version_or_stream)
version = Version('5.8.0')
is_downstream = True
is_pod = False
build = 'missing :)'
Expand Down Expand Up @@ -2702,7 +2681,6 @@ def load_appliances_from_config(config):
class ApplianceSummoningWarning(Warning):
"""to ease filtering/erroring on magical appliance creation based on script vs code"""


def get_or_create_current_appliance():
if stack.top is None:
warnings.warn(
Expand Down
11 changes: 5 additions & 6 deletions scripts/dockerbot/pytestbase/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
FROM fedora:25

RUN dnf install -y gcc postgresql-devel libxml2-devel libxslt-devel zeromq3-devel git nano python-devel gnupg gnupg2 libcurl-devel redhat-rpm-config findutils libffi-devel openssl-devel tesseract freetype-devel gcc-c++ python-pip libjpeg-devel && dnf clean all
ARG CFME_REPO=https://github.com/RedHatQE/cfme_tests.git
ARG CFME_BRANCH=master
RUN git clone -b $CFME_BRANCH $CFME_REPO /cfme_tests
FROM fedora:23
RUN dnf install -y gcc postgresql-devel libxml2-devel libxslt-devel zeromq3-devel git nano python-devel gnupg gnupg2 libcurl-devel redhat-rpm-config findutils libffi-devel openssl-devel tesseract freetype-devel gcc-c++
RUN git clone https://github.com/RedHatQE/cfme_tests.git
RUN dnf -y install python-setuptools; easy_install pip
RUN pip install -U pip
RUN cd /cfme_tests && PYCURL_SSL_LIBRARY=nss pip install -U -r /cfme_tests/requirements/frozen.txt --no-cache-dir
ADD setup.sh /setup.sh
ADD post_result.py /post_result.py
Expand Down
36 changes: 6 additions & 30 deletions scripts/dockerbot/pytestbase/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ on_exit () {
log "Checking out master branch..."
git checkout origin/master
log "Running pip update..."
(run_pip_update) # subshell to avoid exit in failure
run_pip_update
log "#*"
if [ -n "$POST_TASK" ]; then
[ $RES -eq 0 ] || [ $RES -eq 5 ] && OUT_RESULT="passed" || OUT_RESULT="failed"
Expand Down Expand Up @@ -62,25 +62,13 @@ do_or_die () {
done
}


gate() {
log "gating $2 to $ARTIFACTOR_DIR/$1"
eval "$2" >> $ARTIFACTOR_DIR/$1 2>&1
local RES=$?
if [ "$RES" -ne "0" ]
then
log "failed"
exit $RES
fi
}

# Runs pip update - optionally can make use of wheelhouse
run_pip_update () {
export PYCURL_SSL_LIBRARY=nss
if [ -n "$WHEEL_HOST_URL" ]; then
export PIP_TRUSTED_HOST="$WHEEL_HOST" PIP_FIND_LINKS="$WHEEL_HOST_URL"
run_n_log "PYCURL_SSL_LIBRARY=nss pip install --trusted-host $WHEEL_HOST -f $WHEEL_HOST_URL -Ur $CFME_REPO_DIR/requirements/frozen.txt --no-cache-dir"
else
run_n_log "PYCURL_SSL_LIBRARY=nss pip install -Ur $CFME_REPO_DIR/requirements/frozen.txt --no-cache-dir"
fi
gate "pip_install.txt" "pip install -Ur $CFME_REPO_DIR/requirements/frozen.txt --no-cache-dir"
# ensures entrypoint updates
run_n_log "pip install -e ."
}
Expand Down Expand Up @@ -146,7 +134,7 @@ log "#*"

log "GPG Checking #~"
# Get the GPG-Keys
gate "get_keys.txt" "do_or_die /get_keys.py 5 1"
do_or_die "/get_keys.py >> $ARTIFACTOR_DIR/setup.txt 2>&1" 5 1

# die on errors
set -e
Expand Down Expand Up @@ -231,26 +219,14 @@ run_n_log "find $CFME_REPO_DIR -name \"*.pyc\" -exec rm -rf {} \;"

set +e




if [ "$USE_SPROUT" = "yes" ];
then
log "invoking complete collectonly with dummy instance before test"
gate "collectonly.txt" "py.test --collectonly --dummy-appliance --dummy-appliance-version $SPROUT_GROUP --use-provider complete"

run_n_log "miq sprout checkout --populate-yaml" &
miq sprout checkout --populate-yaml 2>&1 >> $ARTIFACTOR_DIR/setup.txt &
sleep 5
do_or_die "(date && grep -q appliances: conf/env.local.yaml)>> $ARTIFACTOR_DIR/setup.txt" 5 60
else
log "no sprout used"
log "invoking complete collectonly with given appliance instance before test"
gate "collectonly.txt" "py.test --collectonly --use-provider complete"
fi

log "smoke testing"
gate "smoke.txt" "py.test -m smoke"

# Finally, run the py.test
log "$PYTEST"

Expand Down

0 comments on commit 310388b

Please sign in to comment.