Fix zuul testing
This change fixes python 3.8 unit tests. Unfortunately using grouping parentheses in with statements is a python 3.9+ feature. I had to replace the parentheses with a less elegant "\" to escape continuation lines. I also included a .zuul.yaml, without which this couldn't get merged and a .gitreview for convinience. The telemetry-dsvm-* tests are non-voting for now. There isn't any relevant test for this repositary there as of right now, those will get added in the next few weeks. And unfortunately all the telemetry-dsvm-* tests fail due to pyparsing version mismatch right now. Once I or anyone else adds relevant tests to the telemetry tempest plugin, we can make the tests voting here. Co-authored-by: Martin Magr <mmagr@redhat.com> Co-authored-by: Erno Kuvaja <jokke@usr.fi> Change-Id: Icc7b0229bca0664ee7fd60e3932df8f599beb500
This commit is contained in:
parent
53b335aaca
commit
26687730b3
60
.gitignore
vendored
60
.gitignore
vendored
@ -1,4 +1,58 @@
|
|||||||
*\.egg-info
|
*.py[cod]
|
||||||
*\.py[co]
|
|
||||||
\.eggs
|
# C extensions
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# Packages
|
||||||
|
*.egg
|
||||||
|
*.egg-info
|
||||||
dist
|
dist
|
||||||
|
build
|
||||||
|
.eggs
|
||||||
|
eggs
|
||||||
|
parts
|
||||||
|
bin
|
||||||
|
var
|
||||||
|
sdist
|
||||||
|
develop-eggs
|
||||||
|
.installed.cfg
|
||||||
|
lib
|
||||||
|
lib64
|
||||||
|
|
||||||
|
# Installer logs
|
||||||
|
pip-log.txt
|
||||||
|
|
||||||
|
# Unit test / coverage reports
|
||||||
|
.coverage
|
||||||
|
.tox
|
||||||
|
nosetests.xml
|
||||||
|
.stestr/
|
||||||
|
.venv
|
||||||
|
|
||||||
|
# Translations
|
||||||
|
*.mo
|
||||||
|
|
||||||
|
# Mr Developer
|
||||||
|
.mr.developer.cfg
|
||||||
|
.project
|
||||||
|
.pydevproject
|
||||||
|
|
||||||
|
# Complexity
|
||||||
|
output/*.html
|
||||||
|
output/*/index.html
|
||||||
|
|
||||||
|
# Sphinx
|
||||||
|
doc/build
|
||||||
|
releasenotes/build
|
||||||
|
|
||||||
|
# pbr generates these
|
||||||
|
AUTHORS
|
||||||
|
ChangeLog
|
||||||
|
|
||||||
|
# Editors
|
||||||
|
*~
|
||||||
|
.*.swp
|
||||||
|
.*sw?
|
||||||
|
|
||||||
|
# generated docs
|
||||||
|
doc/source/ref/
|
||||||
|
5
.gitreview
Normal file
5
.gitreview
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[gerrit]
|
||||||
|
host=review.opendev.org
|
||||||
|
port=29418
|
||||||
|
project=openstack/python-observabilityclient.git
|
||||||
|
defaultbranch=master
|
41
.zuul.yaml
Normal file
41
.zuul.yaml
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
- project:
|
||||||
|
queue: telemetry
|
||||||
|
templates:
|
||||||
|
- openstack-python3-jobs
|
||||||
|
- check-requirements
|
||||||
|
#- release-notes-jobs-python3
|
||||||
|
check:
|
||||||
|
jobs:
|
||||||
|
- telemetry-dsvm-integration:
|
||||||
|
irrelevant-files: &pobsc-irrelevant-files
|
||||||
|
- ^(test-|)requirements.txt$
|
||||||
|
- ^setup.cfg$
|
||||||
|
- ^.*\.rst$
|
||||||
|
- ^releasenotes/.*$
|
||||||
|
- ^observabilityclient/tests/.*$
|
||||||
|
- ^tools/.*$
|
||||||
|
- ^tox.ini$
|
||||||
|
voting: false
|
||||||
|
- telemetry-dsvm-integration-ipv6-only:
|
||||||
|
irrelevant-files: *pobsc-irrelevant-files
|
||||||
|
voting: false
|
||||||
|
- telemetry-dsvm-integration-centos-9s:
|
||||||
|
irrelevant-files: *pobsc-irrelevant-files
|
||||||
|
voting: false
|
||||||
|
- telemetry-dsvm-integration-centos-9s-fips:
|
||||||
|
irrelevant-files: *pobsc-irrelevant-files
|
||||||
|
voting: false
|
||||||
|
gate:
|
||||||
|
jobs:
|
||||||
|
- telemetry-dsvm-integration:
|
||||||
|
irrelevant-files: *pobsc-irrelevant-files
|
||||||
|
voting: false
|
||||||
|
- telemetry-dsvm-integration-ipv6-only:
|
||||||
|
irrelevant-files: *pobsc-irrelevant-files
|
||||||
|
voting: false
|
||||||
|
- telemetry-dsvm-integration-centos-9s:
|
||||||
|
irrelevant-files: *pobsc-irrelevant-files
|
||||||
|
voting: false
|
||||||
|
- telemetry-dsvm-integration-centos-9s-fips:
|
||||||
|
irrelevant-files: *pobsc-irrelevant-files
|
||||||
|
voting: false
|
@ -35,10 +35,10 @@ class CliTest(testtools.TestCase):
|
|||||||
expected = (['metric_name'], [['name1'], ['name2'], ['name3']])
|
expected = (['metric_name'], [['name1'], ['name2'], ['name3']])
|
||||||
cli_list = cli.List(mock.Mock(), mock.Mock())
|
cli_list = cli.List(mock.Mock(), mock.Mock())
|
||||||
|
|
||||||
with (mock.patch.object(metric_utils, 'get_client',
|
with mock.patch.object(metric_utils, 'get_client',
|
||||||
return_value=self.client),
|
return_value=self.client), \
|
||||||
mock.patch.object(self.client.query, 'list',
|
mock.patch.object(self.client.query, 'list',
|
||||||
return_value=metric_names) as m):
|
return_value=metric_names) as m:
|
||||||
ret1 = cli_list.take_action(args_enabled)
|
ret1 = cli_list.take_action(args_enabled)
|
||||||
m.assert_called_with(disable_rbac=False)
|
m.assert_called_with(disable_rbac=False)
|
||||||
|
|
||||||
@ -61,10 +61,10 @@ class CliTest(testtools.TestCase):
|
|||||||
|
|
||||||
cli_show = cli.Show(mock.Mock(), mock.Mock())
|
cli_show = cli.Show(mock.Mock(), mock.Mock())
|
||||||
|
|
||||||
with (mock.patch.object(metric_utils, 'get_client',
|
with mock.patch.object(metric_utils, 'get_client',
|
||||||
return_value=self.client),
|
return_value=self.client), \
|
||||||
mock.patch.object(self.client.query, 'show',
|
mock.patch.object(self.client.query, 'show',
|
||||||
return_value=prom_metric) as m):
|
return_value=prom_metric) as m:
|
||||||
|
|
||||||
ret1 = cli_show.take_action(args_enabled)
|
ret1 = cli_show.take_action(args_enabled)
|
||||||
m.assert_called_with('metric_name', disable_rbac=False)
|
m.assert_called_with('metric_name', disable_rbac=False)
|
||||||
@ -91,10 +91,10 @@ class CliTest(testtools.TestCase):
|
|||||||
|
|
||||||
cli_query = cli.Query(mock.Mock(), mock.Mock())
|
cli_query = cli.Query(mock.Mock(), mock.Mock())
|
||||||
|
|
||||||
with (mock.patch.object(metric_utils, 'get_client',
|
with mock.patch.object(metric_utils, 'get_client',
|
||||||
return_value=self.client),
|
return_value=self.client), \
|
||||||
mock.patch.object(self.client.query, 'query',
|
mock.patch.object(self.client.query, 'query',
|
||||||
return_value=prom_metric) as m):
|
return_value=prom_metric) as m:
|
||||||
|
|
||||||
ret1 = cli_query.take_action(args_enabled)
|
ret1 = cli_query.take_action(args_enabled)
|
||||||
m.assert_called_with(query, disable_rbac=False)
|
m.assert_called_with(query, disable_rbac=False)
|
||||||
@ -111,9 +111,9 @@ class CliTest(testtools.TestCase):
|
|||||||
|
|
||||||
cli_delete = cli.Delete(mock.Mock(), mock.Mock())
|
cli_delete = cli.Delete(mock.Mock(), mock.Mock())
|
||||||
|
|
||||||
with (mock.patch.object(metric_utils, 'get_client',
|
with mock.patch.object(metric_utils, 'get_client',
|
||||||
return_value=self.client),
|
return_value=self.client), \
|
||||||
mock.patch.object(self.client.query, 'delete') as m):
|
mock.patch.object(self.client.query, 'delete') as m:
|
||||||
|
|
||||||
cli_delete.take_action(args)
|
cli_delete.take_action(args)
|
||||||
m.assert_called_with(matches, 0, 10)
|
m.assert_called_with(matches, 0, 10)
|
||||||
@ -121,9 +121,9 @@ class CliTest(testtools.TestCase):
|
|||||||
def test_clean_combstones(self):
|
def test_clean_combstones(self):
|
||||||
cli_clean_tombstones = cli.CleanTombstones(mock.Mock(), mock.Mock())
|
cli_clean_tombstones = cli.CleanTombstones(mock.Mock(), mock.Mock())
|
||||||
|
|
||||||
with (mock.patch.object(metric_utils, 'get_client',
|
with mock.patch.object(metric_utils, 'get_client',
|
||||||
return_value=self.client),
|
return_value=self.client), \
|
||||||
mock.patch.object(self.client.query, 'clean_tombstones') as m):
|
mock.patch.object(self.client.query, 'clean_tombstones') as m:
|
||||||
|
|
||||||
cli_clean_tombstones.take_action({})
|
cli_clean_tombstones.take_action({})
|
||||||
m.assert_called_once()
|
m.assert_called_once()
|
||||||
@ -132,10 +132,10 @@ class CliTest(testtools.TestCase):
|
|||||||
cli_snapshot = cli.Snapshot(mock.Mock(), mock.Mock())
|
cli_snapshot = cli.Snapshot(mock.Mock(), mock.Mock())
|
||||||
file_name = 'some_file_name'
|
file_name = 'some_file_name'
|
||||||
|
|
||||||
with (mock.patch.object(metric_utils, 'get_client',
|
with mock.patch.object(metric_utils, 'get_client',
|
||||||
return_value=self.client),
|
return_value=self.client), \
|
||||||
mock.patch.object(self.client.query, 'snapshot',
|
mock.patch.object(self.client.query, 'snapshot',
|
||||||
return_value=file_name) as m):
|
return_value=file_name) as m:
|
||||||
|
|
||||||
ret = cli_snapshot.take_action({})
|
ret = cli_snapshot.take_action({})
|
||||||
m.assert_called_once()
|
m.assert_called_once()
|
||||||
|
@ -26,8 +26,8 @@ class GetConfigFileTest(testtools.TestCase):
|
|||||||
super(GetConfigFileTest, self).setUp()
|
super(GetConfigFileTest, self).setUp()
|
||||||
|
|
||||||
def test_current_dir(self):
|
def test_current_dir(self):
|
||||||
with (mock.patch.object(os.path, 'exists', return_value=True),
|
with mock.patch.object(os.path, 'exists', return_value=True), \
|
||||||
mock.patch.object(metric_utils, 'open') as m):
|
mock.patch.object(metric_utils, 'open') as m:
|
||||||
metric_utils.get_config_file()
|
metric_utils.get_config_file()
|
||||||
m.assert_called_with(metric_utils.CONFIG_FILE_NAME, 'r')
|
m.assert_called_with(metric_utils.CONFIG_FILE_NAME, 'r')
|
||||||
|
|
||||||
@ -50,35 +50,35 @@ class GetPrometheusClientTest(testtools.TestCase):
|
|||||||
self.config_file = mock.mock_open(read_data=config_data)("name", 'r')
|
self.config_file = mock.mock_open(read_data=config_data)("name", 'r')
|
||||||
|
|
||||||
def test_get_prometheus_client_from_file(self):
|
def test_get_prometheus_client_from_file(self):
|
||||||
with (mock.patch.object(metric_utils, 'get_config_file',
|
with mock.patch.object(metric_utils, 'get_config_file',
|
||||||
return_value=self.config_file),
|
return_value=self.config_file), \
|
||||||
mock.patch.object(prometheus_client.PrometheusAPIClient,
|
mock.patch.object(prometheus_client.PrometheusAPIClient,
|
||||||
"__init__", return_value=None) as m):
|
"__init__", return_value=None) as m:
|
||||||
metric_utils.get_prometheus_client()
|
metric_utils.get_prometheus_client()
|
||||||
m.assert_called_with("somehost:1234")
|
m.assert_called_with("somehost:1234")
|
||||||
|
|
||||||
def test_get_prometheus_client_env_overide(self):
|
def test_get_prometheus_client_env_overide(self):
|
||||||
with (mock.patch.dict(os.environ, {'PROMETHEUS_HOST': 'env_overide'}),
|
with mock.patch.dict(os.environ, {'PROMETHEUS_HOST': 'env_overide'}), \
|
||||||
mock.patch.object(metric_utils, 'get_config_file',
|
mock.patch.object(metric_utils, 'get_config_file',
|
||||||
return_value=self.config_file),
|
return_value=self.config_file), \
|
||||||
mock.patch.object(prometheus_client.PrometheusAPIClient,
|
mock.patch.object(prometheus_client.PrometheusAPIClient,
|
||||||
"__init__", return_value=None) as m):
|
"__init__", return_value=None) as m:
|
||||||
metric_utils.get_prometheus_client()
|
metric_utils.get_prometheus_client()
|
||||||
m.assert_called_with("env_overide:1234")
|
m.assert_called_with("env_overide:1234")
|
||||||
|
|
||||||
def test_get_prometheus_client_no_config_file(self):
|
def test_get_prometheus_client_no_config_file(self):
|
||||||
patched_env = {'PROMETHEUS_HOST': 'env_overide',
|
patched_env = {'PROMETHEUS_HOST': 'env_overide',
|
||||||
'PROMETHEUS_PORT': 'env_port'}
|
'PROMETHEUS_PORT': 'env_port'}
|
||||||
with (mock.patch.dict(os.environ, patched_env),
|
with mock.patch.dict(os.environ, patched_env), \
|
||||||
mock.patch.object(prometheus_client.PrometheusAPIClient,
|
mock.patch.object(prometheus_client.PrometheusAPIClient,
|
||||||
"__init__", return_value=None) as m):
|
"__init__", return_value=None) as m:
|
||||||
metric_utils.get_prometheus_client()
|
metric_utils.get_prometheus_client()
|
||||||
m.assert_called_with("env_overide:env_port")
|
m.assert_called_with("env_overide:env_port")
|
||||||
|
|
||||||
def test_get_prometheus_client_missing_configuration(self):
|
def test_get_prometheus_client_missing_configuration(self):
|
||||||
with (mock.patch.dict(os.environ, {}),
|
with mock.patch.dict(os.environ, {}), \
|
||||||
mock.patch.object(prometheus_client.PrometheusAPIClient,
|
mock.patch.object(prometheus_client.PrometheusAPIClient,
|
||||||
"__init__", return_value=None)):
|
"__init__", return_value=None):
|
||||||
self.assertRaises(metric_utils.ConfigurationError,
|
self.assertRaises(metric_utils.ConfigurationError,
|
||||||
metric_utils.get_prometheus_client)
|
metric_utils.get_prometheus_client)
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
osc-lib>=1.0.1 # Apache-2.0
|
osc-lib>=1.0.1 # Apache-2.0
|
||||||
keystoneauth1>=1.0.0
|
keystoneauth1>=1.0.0
|
||||||
cliff!=1.16.0,>=1.14.0 # Apache-2.0
|
cliff>=1.14.0 # Apache-2.0
|
||||||
|
Loading…
Reference in New Issue
Block a user