Created test case to verify default values for plugin setup.

Updated test docs accordingly.

Change-Id: I68f3c8449ea488df4da42ed750dfef6873a713e7
This commit is contained in:
Vitalii Yerys 2016-08-08 18:21:15 +03:00
parent 758541150a
commit 212f72d155
6 changed files with 141 additions and 0 deletions

View File

@ -220,3 +220,4 @@ An ordinary test cycle for each iteration consists of the following steps:
-------------
.. include:: test_suite_somke_bvt.rst
.. include:: test_gcs_gui.rst

View File

@ -0,0 +1,37 @@
===================
GUI verify defaults
===================
UI test
-------
ID
##
gcs_gui_defaults
Description
###########
Test case designed to verify if plugin is being deployed with correct default
values set.
Complexity
##########
core
Steps
#####
1. Create cluster
2. Upload plugin to the master node
3. Install plugin
4. Verify default values
Expected results
################
All steps must be completed successfully, without any errors.

View File

@ -16,9 +16,13 @@
import os
from proboscis.asserts import assert_equal
from proboscis.asserts import assert_false
from fuelweb_test.tests.base_test_case import TestBasic
from fuelweb_test import logger
from fuelweb_test.helpers import utils
from helpers import gcs_settings
class GcsTestBase(TestBasic):
@ -48,3 +52,30 @@ class GcsTestBase(TestBasic):
'/var')
utils.install_plugin_check_code(
master_remote.host, os.path.basename(os.environ['GCS_PLUGIN_RPM']))
def verify_defaults(self, cluster_id):
"""Method designed to verify plugin default values."""
attr = self.fuel_web.client.get_cluster_attributes(cluster_id)
assert_false(
attr['editable'][gcs_settings.plugin_name]['metadata']['enabled'],
'Plugin should be disabled by default.')
# attr value is being assigned twice in order to fit PEP8 restriction:
# lines in file can not be longer than 80 characters.
attr = attr['editable'][gcs_settings.plugin_name]['metadata']
attr = attr['versions'][0]
error_list = []
for key in gcs_settings.default_values.keys():
next_key = 'value'
if key == 'metadata':
next_key = 'hot_pluggable'
msg = 'Default value is incorrect, got {} = {} instead of {}'
try:
assert_equal(gcs_settings.default_values[key],
attr[key][next_key],
msg.format(key,
attr[key][next_key],
gcs_settings.default_values[key]))
except AssertionError as e:
error_list.append(''.join(('\n', str(e))))
error_msg = ''.join(error_list)
assert_equal(len(error_msg), 0, error_msg)

View File

@ -33,3 +33,30 @@ options = {
'gcs_client_email/value': os.environ['GCS_CLIENT_EMAIL'],
'gcs_client_id/value': os.environ['GCS_CLIENT_ID']
}
default_values = {
'backup_gcs_advanced_settings': False,
'backup_gcs_enable_progress_timer': True,
'backup_gcs_retry_error_codes': '429',
'backup_gcs_writer_chunk_size': '2097152',
'backup_gcs_bucket_location': 'US',
'backup_gcs_bucket': '',
'backup_gcs_project_id': '',
'backup_gcs_block_size': '32768',
'backup_gcs_object_size': '52428800',
'backup_gcs_storage_class': 'NEARLINE',
'backup_gcs_user_agent': 'gcscinder',
'backup_gcs_reader_chunk_size': '2097152',
'backup_gcs_num_retries': '3',
'metadata': True,
'gcs_private_key': '',
'gcs_private_key_id': '',
'gcs_token_uri': 'https://accounts.google.com/o/oauth2/token',
'gcs_client_x509_cert_url': '',
'gcs_auth_provider_x509_cert_url': 'https://www.googleapis.com/'
'oauth2/v1/certs',
'gcs_client_email': '',
'gcs_auth_uri': 'https://accounts.google.com/o/oauth2/auth',
'gcs_client_id': '',
'gcs_account_type': 'service_account'
}

View File

@ -48,6 +48,7 @@ class CloseSSHConnectionsPlugin(Plugin):
def import_tests():
"""Import test suite of project."""
from tests import test_gcs_smoke_bvt
from tests import test_gcs_gui
def run_tests():

View File

@ -0,0 +1,44 @@
# Copyright 2016 Mirantis, Inc.
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Module with ui defaults verification test."""
from proboscis import test
from fuelweb_test.helpers.decorators import log_snapshot_after_test
from fuelweb_test.tests.base_test_case import SetupEnvironment
from helpers.gcs_base import GcsTestBase
@test(groups=["test_gcs_all"])
class TestGCSPlugin(GcsTestBase):
"""TestGCSPlugin.""" # TODO(unknown) documentation
@test(depends_on=[SetupEnvironment.prepare_slaves_3],
groups=["gcs_gui_defaults"])
@log_snapshot_after_test
def gcs_gui_defaults(self):
"""Create non HA cluster with GCS plugin installed.
Scenario:
1. Create cluster
2. Install GCS plugin
3. Verify default values
"""
self.env.revert_snapshot("ready_with_3_slaves")
cluster_id = self.fuel_web.get_last_created_cluster()
self.install_plugin()
self.verify_defaults(cluster_id)
self.env.make_snapshot("gcs_gui_defaults")