tests: Use swarm-mode for api tests
* Swarm-mode is the fastest cluster to deploy since it doesn't require to pull anything from outside. * Add the output nodes for swarm-mode too. * Disable copy logs (I think a better practice is to copy logs on demand). * Don't run test_create_list_sign_delete_clusters, because it is very unstable on the CI. Partially-Implements: blueprint swarm-mode-support 2nd commit message: Update to Fedora Atomic 26 This patch moves the current master to test against Fedora Atomic 26, in addition, it switches to downloading from Fedora mirrors. 2nd-Change-Id: I9a97c0eb78b2c9d10e8be1501babb19e73ee70c1 3rd commit message: Set default iptables FORWARD policy to ACCEPT With the release of Docker 1.13 which is available in Fedora Atomic 26, it no longer sets the policy of the FORWARD chain to ACCEPT[1]. Therefore, CNI networking such as Flannel will cease to work. This patch sets the policy to ACCEPT so that traffic can work once again for deployments which are based on Docker versions which are newer than 1.13 [1]: https://github.com/moby/moby/pull/28257 3rd-Change-Id: I1457602748619f38f87542fc01a2996ee80e58b7 Closes-Bug: #1708454 Co-Authored-By: Mohammed Naser <mnaser@vexxhost.com> Change-Id: I86d4dcc94fff622be4ee2acc8dd60ed81bc5d433
This commit is contained in:
parent
fdf6f57591
commit
4fb91cc109
@ -13,7 +13,7 @@ if is_service_enabled magnum-api magnum-cond; then
|
||||
echo_summary "Installing magnum"
|
||||
install_magnum
|
||||
|
||||
MAGNUM_GUEST_IMAGE_URL=${MAGNUM_GUEST_IMAGE_URL:-"https://fedorapeople.org/groups/magnum/fedora-atomic-latest.qcow2"}
|
||||
MAGNUM_GUEST_IMAGE_URL=${MAGNUM_GUEST_IMAGE_URL:-"https://download.fedoraproject.org/pub/alt/atomic/stable/Fedora-Atomic-26-20170723.0/CloudImages/x86_64/images/Fedora-Atomic-26-20170723.0.x86_64.qcow2"}
|
||||
IMAGE_URLS+=",${MAGNUM_GUEST_IMAGE_URL}"
|
||||
|
||||
LIBS_FROM_GIT="${LIBS_FROM_GIT},python-magnumclient"
|
||||
|
@ -2490,11 +2490,11 @@ The image currently has the following OS/software:
|
||||
+-------------+-----------+
|
||||
| OS/software | version |
|
||||
+=============+===========+
|
||||
| Fedora | 25 |
|
||||
| Fedora | 26 |
|
||||
+-------------+-----------+
|
||||
| Docker | 1.12.6 |
|
||||
| Docker | 1.13.1 |
|
||||
+-------------+-----------+
|
||||
| Kubernetes | 1.5.3 |
|
||||
| Kubernetes | 1.6.7 |
|
||||
+-------------+-----------+
|
||||
| etcd | 3.1.3 |
|
||||
+-------------+-----------+
|
||||
|
@ -116,7 +116,7 @@ and tested by the Magnum team.
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
$ wget https://fedorapeople.org/groups/magnum/fedora-atomic-latest.qcow2
|
||||
$ wget https://download.fedoraproject.org/pub/alt/atomic/stable/Fedora-Atomic-26-20170723.0/CloudImages/x86_64/images/Fedora-Atomic-26-20170723.0.x86_64.qcow2
|
||||
|
||||
#. Register the image to the Image service setting the ``os_distro`` property
|
||||
to ``fedora-atomic``:
|
||||
@ -390,7 +390,7 @@ will create a deployment.
|
||||
| status_reason | Stack CREATE completed successfully |
|
||||
| created_at | 2017-05-16T09:58:02+00:00 |
|
||||
| updated_at | 2017-05-16T10:00:02+00:00 |
|
||||
| coe_version | v1.5.3 |
|
||||
| coe_version | v1.6.7 |
|
||||
| keypair | default |
|
||||
| api_address | https://172.24.4.13:6443 |
|
||||
| master_addresses | ['172.24.4.13'] |
|
||||
|
@ -22,6 +22,10 @@ if ! [ "\$FLANNEL_SUBNET" ] && [ "\$FLANNEL_MTU" ] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# NOTE(mnaser): Since Docker 1.13, it does not set the default forwarding
|
||||
# policy to ACCEPT which will cause CNI networking to fail.
|
||||
iptables -P FORWARD ACCEPT
|
||||
|
||||
mkdir -p /run/flannel/
|
||||
cat > /run/flannel/docker <<EOF2
|
||||
DOCKER_NETWORK_OPTIONS="--bip=\$FLANNEL_SUBNET --mtu=\$FLANNEL_MTU"
|
||||
|
@ -58,6 +58,10 @@ if ! [ "\$FLANNEL_SUBNET" ] && [ "\$FLANNEL_MTU" ] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# NOTE(mnaser): Since Docker 1.13, it does not set the default forwarding
|
||||
# policy to ACCEPT which will cause CNI networking to fail.
|
||||
iptables -P FORWARD ACCEPT
|
||||
|
||||
mkdir -p /run/flannel/
|
||||
cat > /run/flannel/docker <<EOF
|
||||
DOCKER_NETWORK_OPTIONS="--bip=\$FLANNEL_SUBNET --mtu=\$FLANNEL_MTU"
|
||||
|
@ -316,7 +316,7 @@ parameters:
|
||||
kube_version:
|
||||
type: string
|
||||
description: version of kubernetes used for kubernetes cluster
|
||||
default: v1.5.3
|
||||
default: v1.6.7
|
||||
|
||||
kube_dashboard_version:
|
||||
type: string
|
||||
|
@ -37,6 +37,11 @@ if egrep --quiet '(vmx|svm)' /proc/cpuinfo; then
|
||||
export DEVSTACK_GATE_LIBVIRT_TYPE=kvm
|
||||
fi
|
||||
|
||||
if [[ -e /etc/ci/mirror_info.sh ]]; then
|
||||
source /etc/ci/mirror_info.sh
|
||||
fi
|
||||
|
||||
NODEPOOL_ATOMIC_MIRROR=${NODEPOOL_FEDORA_MIRROR:-https://download.fedoraproject.org/pub/alt}
|
||||
|
||||
if [ "$coe" = "mesos" ]; then
|
||||
export DEVSTACK_LOCAL_CONFIG+=$'\n'"MAGNUM_GUEST_IMAGE_URL=https://fedorapeople.org/groups/magnum/ubuntu-mesos-ocata.qcow2"
|
||||
@ -80,8 +85,8 @@ elif [ "${coe}${special}" = "k8s-ironic" ]; then
|
||||
export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_VM_SPECS_DISK=10"
|
||||
export DEVSTACK_LOCAL_CONFIG+=$'\n'"IRONIC_VM_EPHEMERAL_DISK=5"
|
||||
else
|
||||
export DEVSTACK_LOCAL_CONFIG+=$'\n'"MAGNUM_GUEST_IMAGE_URL='https://fedorapeople.org/groups/magnum/fedora-atomic-latest.qcow2'"
|
||||
export DEVSTACK_LOCAL_CONFIG+=$'\n'"MAGNUM_IMAGE_NAME='fedora-atomic-latest'"
|
||||
export DEVSTACK_LOCAL_CONFIG+=$'\n'"MAGNUM_GUEST_IMAGE_URL='${NODEPOOL_ATOMIC_MIRROR}/atomic/stable/Fedora-Atomic-26-20170723.0/CloudImages/x86_64/images/Fedora-Atomic-26-20170723.0.x86_64.qcow2'"
|
||||
export DEVSTACK_LOCAL_CONFIG+=$'\n'"MAGNUM_IMAGE_NAME='Fedora-Atomic-26-20170723.0.x86_64'"
|
||||
fi
|
||||
|
||||
# Enable magnum plugin in the last step
|
||||
|
@ -171,46 +171,48 @@ if [[ "-ironic" != "$special" ]]; then
|
||||
add_flavor
|
||||
fi
|
||||
|
||||
# Get admin credentials
|
||||
pushd ../devstack
|
||||
source openrc admin admin
|
||||
popd
|
||||
|
||||
create_test_data $coe $special
|
||||
|
||||
local _magnum_tests=""
|
||||
if [[ "api" == "$coe" ]]; then
|
||||
# Import devstack functions 'iniset', 'iniget' and 'trueorfalse'
|
||||
source $BASE/new/devstack/functions
|
||||
echo "TEMPEST_SERVICES+=,magnum" >> $localrc_path
|
||||
pushd $BASE/new/tempest
|
||||
sudo chown -R jenkins:stack $BASE/new/tempest
|
||||
|
||||
# Set demo credentials
|
||||
source $BASE/new/devstack/accrc/demo/demo
|
||||
|
||||
create_test_data $coe
|
||||
export TEMPEST_CONFIG=$BASE/new/tempest/etc/tempest.conf
|
||||
|
||||
# Set up tempest config with magnum goodness
|
||||
iniset $BASE/new/tempest/etc/tempest.conf magnum image_id $IMAGE_ID
|
||||
iniset $BASE/new/tempest/etc/tempest.conf magnum nic_id $NIC_ID
|
||||
iniset $BASE/new/tempest/etc/tempest.conf magnum keypair_id default
|
||||
iniset $BASE/new/tempest/etc/tempest.conf magnum flavor_id s1.magnum
|
||||
iniset $BASE/new/tempest/etc/tempest.conf magnum master_flavor_id m1.magnum
|
||||
iniset $BASE/new/tempest/etc/tempest.conf magnum copy_logs True
|
||||
iniset $TEMPEST_CONFIG magnum image_id $IMAGE_ID
|
||||
iniset $TEMPEST_CONFIG magnum nic_id $NIC_ID
|
||||
iniset $TEMPEST_CONFIG magnum keypair_id default
|
||||
iniset $TEMPEST_CONFIG magnum flavor_id s1.magnum
|
||||
iniset $TEMPEST_CONFIG magnum master_flavor_id m1.magnum
|
||||
iniset $TEMPEST_CONFIG magnum copy_logs True
|
||||
|
||||
# show tempest config with magnum
|
||||
cat etc/tempest.conf
|
||||
cat $TEMPEST_CONFIG
|
||||
|
||||
# Set up concurrency and test regex
|
||||
export MAGNUM_TEMPEST_CONCURRENCY=${MAGNUM_TEMPEST_CONCURRENCY:-1}
|
||||
export MAGNUM_TESTS=${MAGNUM_TESTS:-'magnum.tests.functional.api.v1'}
|
||||
|
||||
echo "Running tempest magnum test suites"
|
||||
sudo -H -u jenkins tox -eall-plugin -- $MAGNUM_TESTS --concurrency=$MAGNUM_TEMPEST_CONCURRENCY
|
||||
else
|
||||
# Get admin credentials
|
||||
pushd ../devstack
|
||||
source openrc admin admin
|
||||
popd
|
||||
|
||||
create_test_data $coe $special
|
||||
|
||||
target="${coe}${special}"
|
||||
sudo -E -H -u jenkins tox -e functional-"$target" -- --concurrency=1
|
||||
# strigazi: don't run test_create_list_sign_delete_clusters because
|
||||
# it is very unstable in the CI
|
||||
_magnum_tests="magnum.tests.functional.api.v1.test_bay"
|
||||
_magnum_tests="$_magnum_tests magnum.tests.functional.api.v1.test_baymodel"
|
||||
_magnum_tests="$_magnum_tests magnum.tests.functional.api.v1.test_cluster_template"
|
||||
_magnum_tests="$_magnum_tests magnum.tests.functional.api.v1.test_cluster_template_admin"
|
||||
_magnum_tests="$_magnum_tests magnum.tests.functional.api.v1.test_magnum_service"
|
||||
_magnum_tests="$_magnum_tests magnum.tests.functional.api.v1.test_cluster.ClusterTest.test_create_cluster_for_nonexisting_cluster_template"
|
||||
_magnum_tests="$_magnum_tests magnum.tests.functional.api.v1.test_cluster.ClusterTest.test_create_cluster_with_node_count_0"
|
||||
_magnum_tests="$_magnum_tests magnum.tests.functional.api.v1.test_cluster.ClusterTest.test_create_cluster_with_nonexisting_flavor"
|
||||
_magnum_tests="$_magnum_tests magnum.tests.functional.api.v1.test_cluster.ClusterTest.test_create_cluster_with_zero_masters"
|
||||
_magnum_tests="$_magnum_tests magnum.tests.functional.api.v1.test_cluster.ClusterTest.test_delete_cluster_for_nonexisting_cluster"
|
||||
_magnum_tests="$_magnum_tests magnum.tests.functional.api.v1.test_cluster.ClusterTest.test_update_cluster_for_nonexisting_cluster"
|
||||
fi
|
||||
|
||||
target="${coe}${special}"
|
||||
sudo -E -H -u jenkins tox -e functional-"$target" $_magnum_tests -- --concurrency=1
|
||||
|
||||
EXIT_CODE=$?
|
||||
|
||||
# Delete the keypair used in the functional test.
|
||||
|
@ -58,7 +58,7 @@ class BayTest(base.BaseTempestTest):
|
||||
creds=self.creds,
|
||||
type_of_creds='default',
|
||||
request_type='cert')
|
||||
model = datagen.valid_swarm_baymodel()
|
||||
model = datagen.valid_swarm_mode_baymodel()
|
||||
_, self.baymodel = self._create_baymodel(model)
|
||||
|
||||
# NOTE (dimtruck) by default tempest sets timeout to 20 mins.
|
||||
|
@ -74,7 +74,7 @@ class BayModelTest(base.BaseTempestTest):
|
||||
|
||||
@testtools.testcase.attr('positive')
|
||||
def test_create_get_public_baymodel(self):
|
||||
gen_model = datagen.valid_swarm_baymodel(is_public=True)
|
||||
gen_model = datagen.valid_swarm_mode_baymodel(is_public=True)
|
||||
self.assertRaises(
|
||||
exceptions.Forbidden,
|
||||
self.baymodel_client.post_baymodel, gen_model)
|
||||
|
@ -57,7 +57,7 @@ class BayModelAdminTest(base.BaseTempestTest):
|
||||
|
||||
@testtools.testcase.attr('positive')
|
||||
def test_create_get_public_baymodel(self):
|
||||
gen_model = datagen.valid_swarm_baymodel(is_public=True)
|
||||
gen_model = datagen.valid_swarm_mode_baymodel(is_public=True)
|
||||
resp, model = self._create_baymodel(gen_model)
|
||||
|
||||
resp, model = self.baymodel_client.get_baymodel(model.uuid)
|
||||
|
@ -63,7 +63,7 @@ class ClusterTest(base.BaseTempestTest):
|
||||
creds=self.creds,
|
||||
type_of_creds='default',
|
||||
request_type='cert')
|
||||
model = datagen.valid_swarm_cluster_template()
|
||||
model = datagen.valid_swarm_mode_cluster_template()
|
||||
_, self.cluster_template = self._create_cluster_template(model)
|
||||
|
||||
# NOTE (dimtruck) by default tempest sets timeout to 20 mins.
|
||||
|
@ -79,7 +79,7 @@ class ClusterTemplateTest(base.BaseTempestTest):
|
||||
|
||||
@testtools.testcase.attr('positive')
|
||||
def test_create_get_public_cluster_template(self):
|
||||
gen_model = datagen.valid_swarm_cluster_template(is_public=True)
|
||||
gen_model = datagen.valid_swarm_mode_cluster_template(is_public=True)
|
||||
self.assertRaises(
|
||||
exceptions.Forbidden,
|
||||
self.cluster_template_client.post_cluster_template, gen_model)
|
||||
|
@ -59,7 +59,7 @@ class ClusterTemplateAdminTest(base.BaseTempestTest):
|
||||
|
||||
@testtools.testcase.attr('positive')
|
||||
def test_create_get_public_cluster_template(self):
|
||||
gen_model = datagen.valid_swarm_cluster_template(is_public=True)
|
||||
gen_model = datagen.valid_swarm_mode_cluster_template(is_public=True)
|
||||
resp, model = self._create_cluster_template(gen_model)
|
||||
|
||||
resp, model = \
|
||||
|
@ -37,6 +37,7 @@ def gen_coe_dep_network_driver(coe):
|
||||
allowed_driver_types = {
|
||||
'kubernetes': ['flannel', None],
|
||||
'swarm': ['docker', 'flannel', None],
|
||||
'swarm-mode': ['docker', None],
|
||||
'mesos': ['docker', None],
|
||||
}
|
||||
driver_types = allowed_driver_types[coe]
|
||||
@ -47,6 +48,7 @@ def gen_coe_dep_volume_driver(coe):
|
||||
allowed_driver_types = {
|
||||
'kubernetes': ['cinder', None],
|
||||
'swarm': ['rexray', None],
|
||||
'swarm-mode': ['rexray', None],
|
||||
'mesos': ['rexray', None],
|
||||
}
|
||||
driver_types = allowed_driver_types[coe]
|
||||
@ -103,7 +105,7 @@ def baymodel_data(**kwargs):
|
||||
|
||||
data = {
|
||||
"name": data_utils.rand_name('bay'),
|
||||
"coe": "swarm",
|
||||
"coe": "swarm-mode",
|
||||
"tls_disabled": False,
|
||||
"network_driver": None,
|
||||
"volume_driver": None,
|
||||
@ -208,8 +210,8 @@ def baymodel_valid_data_with_specific_coe(coe):
|
||||
image_id=config.Config.image_id, coe=coe)
|
||||
|
||||
|
||||
def valid_swarm_baymodel(is_public=False):
|
||||
"""Generates a valid swarm baymodel with valid data
|
||||
def valid_swarm_mode_baymodel(is_public=False):
|
||||
"""Generates a valid swarm mode baymodel with valid data
|
||||
|
||||
:returns: BayModelEntity with generated data
|
||||
"""
|
||||
@ -218,7 +220,7 @@ def valid_swarm_baymodel(is_public=False):
|
||||
flavor_id=config.Config.flavor_id, public=is_public,
|
||||
dns_nameserver=config.Config.dns_nameserver,
|
||||
master_flavor_id=config.Config.master_flavor_id,
|
||||
keypair_id=config.Config.keypair_id, coe="swarm",
|
||||
keypair_id=config.Config.keypair_id, coe="swarm-mode",
|
||||
cluster_distro=None,
|
||||
external_network_id=config.Config.nic_id,
|
||||
http_proxy=None, https_proxy=None, no_proxy=None,
|
||||
@ -343,7 +345,7 @@ def cluster_template_data(**kwargs):
|
||||
|
||||
data = {
|
||||
"name": data_utils.rand_name('cluster'),
|
||||
"coe": "swarm",
|
||||
"coe": "swarm-mode",
|
||||
"tls_disabled": False,
|
||||
"network_driver": None,
|
||||
"volume_driver": None,
|
||||
@ -485,8 +487,8 @@ def cluster_template_valid_data_with_specific_coe(coe):
|
||||
image_id=config.Config.image_id, coe=coe)
|
||||
|
||||
|
||||
def valid_swarm_cluster_template(is_public=False):
|
||||
"""Generates a valid swarm cluster_template with valid data
|
||||
def valid_swarm_mode_cluster_template(is_public=False):
|
||||
"""Generates a valid swarm-mode cluster_template with valid data
|
||||
|
||||
:returns: ClusterTemplateEntity with generated data
|
||||
"""
|
||||
@ -496,7 +498,7 @@ def valid_swarm_cluster_template(is_public=False):
|
||||
public=is_public,
|
||||
dns_nameserver=config.Config.dns_nameserver,
|
||||
master_flavor_id=master_flavor_id,
|
||||
coe="swarm",
|
||||
coe="swarm-mode",
|
||||
cluster_distro=None,
|
||||
external_network_id=config.Config.nic_id,
|
||||
http_proxy=None, https_proxy=None,
|
||||
|
@ -341,6 +341,10 @@ extendedKeyUsage = clientAuth
|
||||
output_keys = ["kube_masters", "kube_minions"]
|
||||
elif self.cluster_template.coe == "swarm":
|
||||
output_keys = ["swarm_masters", "swarm_nodes"]
|
||||
elif self.cluster_template.coe == "swarm-mode":
|
||||
output_keys = ["swarm_primary_master",
|
||||
"swarm_secondary_masters",
|
||||
"swarm_nodes"]
|
||||
elif self.cluster_template.coe == "mesos":
|
||||
output_keys = ["mesos_master", "mesos_slaves"]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user