Fix positional formatting and add skip check
This patch fixes an offset positonal argument in a string format that was throwing an IndexError exception. It also adds a skip check to check if the required amphora SSH key file is readable. Additionally, the iptables-based active-standby test has now a better amphora_ssh_key default value to match with the default path set by the Octavia Devstack plugin. Story: 2006259 Task: 35876 Change-Id: Ic887c726dfe151ea582a1bd935ae0b30582f14ea
This commit is contained in:
parent
7140479919
commit
9891de0ebb
|
@ -173,7 +173,7 @@ OctaviaGroup = [
|
|||
default='ubuntu',
|
||||
help='The amphora SSH user.'),
|
||||
cfg.StrOpt('amphora_ssh_key',
|
||||
default='/tmp/octavia_ssh_key',
|
||||
default='/etc/octavia/.ssh/octavia_ssh_key',
|
||||
help='The amphora SSH key file.'),
|
||||
# Environment specific options
|
||||
# These are used to accomodate clouds with specific limitations
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import os
|
||||
import testtools
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
@ -50,6 +49,8 @@ class ActiveStandbyIptablesScenarioTest(
|
|||
raise cls.skipException("Configured load balancer topology is not "
|
||||
"%s." % const.ACTIVE_STANDBY)
|
||||
|
||||
cls._get_amphora_ssh_key()
|
||||
|
||||
@classmethod
|
||||
def resource_setup(cls):
|
||||
"""Setup resources needed by the tests."""
|
||||
|
@ -230,13 +231,12 @@ class ActiveStandbyIptablesScenarioTest(
|
|||
@classmethod
|
||||
def _get_amphora_ssh_key(cls):
|
||||
key_file = CONF.load_balancer.amphora_ssh_key
|
||||
if not key_file:
|
||||
raise Exception("SSH key file not provided.")
|
||||
if not os.path.isfile(key_file):
|
||||
raise Exception("Could not find amphora ssh key file {1}."
|
||||
try:
|
||||
with open(key_file, 'r') as f:
|
||||
return f.read()
|
||||
except IOError:
|
||||
raise Exception("Could not open amphora SSH key file {0}."
|
||||
.format(key_file))
|
||||
with open(key_file, 'r') as f:
|
||||
return f.read()
|
||||
|
||||
@testtools.skipIf(CONF.load_balancer.test_with_noop,
|
||||
'Active/Standby tests will not work in noop mode.')
|
||||
|
|
|
@ -561,6 +561,7 @@
|
|||
load_balancer:
|
||||
check_timeout: 180
|
||||
loadbalancer_topology: 'ACTIVE_STANDBY'
|
||||
amphora_ssh_key: '/tmp/octavia_ssh_key'
|
||||
tempest_test_regex: ^octavia_tempest_plugin.tests.act_stdby_scenario.v2.test_active_standby_iptables
|
||||
tox_envlist: all
|
||||
|
||||
|
|
Loading…
Reference in New Issue