Update to 0.9.155, fix tests with Python 3.6 and lxml 3.7
Fixes submitted upstream. Note on the change from `rm -r` to `rm -rf`: there is a directory named `test` nested in another directory named `test` (`pcs/test/tools/test`). Depending on the order in which they're found, `rm -r` might wind up trying to remove `pcs/test/tools/test` after `pcs/test`, which is an error and causes %check to fail. `rm -rf` ignores missing targets, so it succeeds even in this scenario.
This commit is contained in:
parent
0775475fd4
commit
f104d71fb7
135
0001-Tests-handle-change-in-an-error-message-in-lxml-3.7.patch
Normal file
135
0001-Tests-handle-change-in-an-error-message-in-lxml-3.7.patch
Normal file
@ -0,0 +1,135 @@
|
||||
From 79543d3f4864ad3cbff98c2600033c49158d79ac Mon Sep 17 00:00:00 2001
|
||||
From: Adam Williamson <awilliam@redhat.com>
|
||||
Date: Wed, 4 Jan 2017 17:54:15 -0800
|
||||
Subject: [PATCH] Tests: handle change in an error message in lxml 3.7
|
||||
|
||||
---
|
||||
pcs/lib/commands/test/test_resource_agent.py | 4 ++--
|
||||
pcs/lib/commands/test/test_stonith_agent.py | 4 ++--
|
||||
pcs/lib/test/test_resource_agent.py | 5 +++--
|
||||
pcs/test/tools/assertions.py | 11 +++++++++++
|
||||
pcs/test/test_lib_cib_tools.py | 4 ++--
|
||||
4 files changed, 20 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/pcs/lib/commands/test/test_resource_agent.py b/pcs/lib/commands/test/test_resource_agent.py
|
||||
index 9652591..ed86d00 100644
|
||||
--- a/pcs/lib/commands/test/test_resource_agent.py
|
||||
+++ b/pcs/lib/commands/test/test_resource_agent.py
|
||||
@@ -8,7 +8,7 @@ from __future__ import (
|
||||
import logging
|
||||
from lxml import etree
|
||||
|
||||
-from pcs.test.tools.assertions import assert_raise_library_error
|
||||
+from pcs.test.tools.assertions import assert_raise_library_error, start_tag_error_text
|
||||
from pcs.test.tools.custom_mock import MockLibraryReportProcessor
|
||||
from pcs.test.tools.pcs_unittest import mock, TestCase
|
||||
|
||||
@@ -353,7 +353,7 @@ class TestDescribeAgent(TestCase):
|
||||
report_codes.UNABLE_TO_GET_AGENT_METADATA,
|
||||
{
|
||||
"agent": "ocf:test:Dummy",
|
||||
- "reason": "Start tag expected, '<' not found, line 1, column 1",
|
||||
+ "reason": start_tag_error_text(),
|
||||
}
|
||||
)
|
||||
)
|
||||
diff --git a/pcs/lib/commands/test/test_stonith_agent.py b/pcs/lib/commands/test/test_stonith_agent.py
|
||||
index eaf5f93..d1e3ed0 100644
|
||||
--- a/pcs/lib/commands/test/test_stonith_agent.py
|
||||
+++ b/pcs/lib/commands/test/test_stonith_agent.py
|
||||
@@ -8,7 +8,7 @@ from __future__ import (
|
||||
import logging
|
||||
from lxml import etree
|
||||
|
||||
-from pcs.test.tools.assertions import assert_raise_library_error
|
||||
+from pcs.test.tools.assertions import assert_raise_library_error, start_tag_error_text
|
||||
from pcs.test.tools.custom_mock import MockLibraryReportProcessor
|
||||
from pcs.test.tools.pcs_unittest import mock, TestCase
|
||||
|
||||
@@ -204,7 +204,7 @@ class TestDescribeAgent(TestCase):
|
||||
report_codes.UNABLE_TO_GET_AGENT_METADATA,
|
||||
{
|
||||
"agent": "fence_dummy",
|
||||
- "reason": "Start tag expected, '<' not found, line 1, column 1",
|
||||
+ "reason": start_tag_error_text(),
|
||||
}
|
||||
)
|
||||
)
|
||||
diff --git a/pcs/lib/test/test_resource_agent.py b/pcs/lib/test/test_resource_agent.py
|
||||
index 5298415..e45b359 100644
|
||||
--- a/pcs/lib/test/test_resource_agent.py
|
||||
+++ b/pcs/lib/test/test_resource_agent.py
|
||||
@@ -12,6 +12,7 @@ from pcs.test.tools.assertions import (
|
||||
ExtendedAssertionsMixin,
|
||||
assert_raise_library_error,
|
||||
assert_xml_equal,
|
||||
+ start_tag_error_text,
|
||||
)
|
||||
from pcs.test.tools.misc import create_patcher
|
||||
from pcs.test.tools.pcs_unittest import TestCase, mock
|
||||
@@ -1069,7 +1070,7 @@ class StonithdMetadataGetMetadataTest(TestCase, ExtendedAssertionsMixin):
|
||||
self.agent._get_metadata,
|
||||
{
|
||||
"agent": "stonithd",
|
||||
- "message": "Start tag expected, '<' not found, line 1, column 1",
|
||||
+ "message": start_tag_error_text(),
|
||||
}
|
||||
)
|
||||
|
||||
@@ -1196,7 +1197,7 @@ class CrmAgentMetadataGetMetadataTest(TestCase, ExtendedAssertionsMixin):
|
||||
self.agent._get_metadata,
|
||||
{
|
||||
"agent": self.agent_name,
|
||||
- "message": "Start tag expected, '<' not found, line 1, column 1",
|
||||
+ "message": start_tag_error_text(),
|
||||
}
|
||||
)
|
||||
|
||||
diff --git a/pcs/test/tools/assertions.py b/pcs/test/tools/assertions.py
|
||||
index 4c8f8df..16e2571 100644
|
||||
--- a/pcs/test/tools/assertions.py
|
||||
+++ b/pcs/test/tools/assertions.py
|
||||
@@ -7,10 +7,21 @@ from __future__ import (
|
||||
|
||||
import doctest
|
||||
from lxml.doctestcompare import LXMLOutputChecker
|
||||
+from lxml.etree import LXML_VERSION
|
||||
|
||||
from pcs.lib.errors import LibraryError
|
||||
from pcs.test.tools.misc import prepare_diff
|
||||
|
||||
+def start_tag_error_text():
|
||||
+ """lxml 3.7+ gives a longer 'start tag expected' error message,
|
||||
+ handle it here so multiple tests can just get the appropriate
|
||||
+ string from this function.
|
||||
+ """
|
||||
+ msg = "Start tag expected, '<' not found, line 1, column 1"
|
||||
+ if LXML_VERSION >= (3, 7, 0, 0):
|
||||
+ msg += " (<string>, line 1)"
|
||||
+ return msg
|
||||
+
|
||||
def console_report(*lines):
|
||||
#after lines append last new line
|
||||
return "\n".join(lines + ("",))
|
||||
--- a/pcs/test/test_lib_cib_tools.py
|
||||
+++ b/pcs/test/test_lib_cib_tools.py
|
||||
@@ -13,6 +13,7 @@
|
||||
from pcs.test.tools.assertions import (
|
||||
assert_raise_library_error,
|
||||
assert_xml_equal,
|
||||
+ start_tag_error_text,
|
||||
)
|
||||
from pcs.test.tools.misc import get_test_resource as rc
|
||||
from pcs.test.tools.pcs_unittest import mock
|
||||
@@ -488,7 +489,7 @@
|
||||
report_codes.CIB_UPGRADE_FAILED,
|
||||
{
|
||||
"reason":
|
||||
- "Start tag expected, '<' not found, line 1, column 1",
|
||||
+ start_tag_error_text(),
|
||||
}
|
||||
)
|
||||
)
|
||||
--
|
||||
2.11.0
|
||||
|
31
122.patch
Normal file
31
122.patch
Normal file
@ -0,0 +1,31 @@
|
||||
From cbc8eb0eeff7ac9076d1455ac4f54113c84dd693 Mon Sep 17 00:00:00 2001
|
||||
From: Adam Williamson <awilliam@redhat.com>
|
||||
Date: Wed, 4 Jan 2017 16:00:15 -0800
|
||||
Subject: [PATCH] Fix tests for Python 3.6
|
||||
|
||||
We need to set a proper value for `env.booth.name` in two more
|
||||
tests, or Python chokes trying to `os.path.join()` a MagicMock.
|
||||
---
|
||||
pcs/lib/commands/test/test_booth.py | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/pcs/lib/commands/test/test_booth.py b/pcs/lib/commands/test/test_booth.py
|
||||
index c24eea2..872760f 100644
|
||||
--- a/pcs/lib/commands/test/test_booth.py
|
||||
+++ b/pcs/lib/commands/test/test_booth.py
|
||||
@@ -111,6 +111,7 @@ def test_raises_when_booth_config_in_use(self):
|
||||
@patch_commands("parse", mock.Mock(side_effect=LibraryError()))
|
||||
def test_raises_when_cannot_get_content_of_config(self):
|
||||
env = mock.MagicMock()
|
||||
+ env.booth.name = "somename"
|
||||
assert_raise_library_error(
|
||||
lambda: commands.config_destroy(env),
|
||||
(
|
||||
@@ -126,6 +127,7 @@ def test_raises_when_cannot_get_content_of_config(self):
|
||||
@patch_commands("parse", mock.Mock(side_effect=LibraryError()))
|
||||
def test_remove_config_even_if_cannot_get_its_content_when_forced(self):
|
||||
env = mock.MagicMock()
|
||||
+ env.booth.name = "somename"
|
||||
env.report_processor = MockLibraryReportProcessor()
|
||||
commands.config_destroy(env, ignore_config_load_problems=True)
|
||||
env.booth.remove_config.assert_called_once_with()
|
@ -38,7 +38,7 @@ index 9a4a4ba..4fd3786 100644
|
||||
- gem install --verbose --no-rdoc --no-ri -l -i vendor/bundle/ruby \
|
||||
- vendor/cache/backports-3.6.8.gem \
|
||||
- vendor/cache/json-1.8.3.gem \
|
||||
- vendor/cache/multi_json-1.12.1.gem \
|
||||
- vendor/cache/multi_json-1.12.0.gem \
|
||||
- vendor/cache/open4-1.3.4.gem \
|
||||
+ gem install --force --verbose --no-rdoc --no-ri -l -i vendor/bundle/ruby \
|
||||
vendor/cache/orderedhash-0.0.6.gem \
|
||||
|
25
pcs.spec
25
pcs.spec
@ -1,6 +1,6 @@
|
||||
Name: pcs
|
||||
Version: 0.9.154
|
||||
Release: 3%{?dist}
|
||||
Version: 0.9.155
|
||||
Release: 1%{?dist}
|
||||
License: GPLv2
|
||||
URL: https://github.com/ClusterLabs/pcs
|
||||
Group: System Environment/Base
|
||||
@ -18,6 +18,11 @@ Source14: https://rubygems.org/downloads/sinatra-1.4.7.gem
|
||||
Source15: https://rubygems.org/downloads/sinatra-contrib-1.4.7.gem
|
||||
|
||||
Patch0: fedfix.patch
|
||||
# Fix tests for Python 3.6
|
||||
Patch1: https://github.com/ClusterLabs/pcs/pull/122.patch
|
||||
# Fix tests for lxml 3.7
|
||||
# https://github.com/ClusterLabs/pcs/pull/121 , rediffed on 0.9.155
|
||||
Patch2: 0001-Tests-handle-change-in-an-error-message-in-lxml-3.7.patch
|
||||
|
||||
# git for patches
|
||||
BuildRequires: git
|
||||
@ -93,6 +98,8 @@ UpdateTimestamps() {
|
||||
}
|
||||
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
UpdateTimestamps -p1 %{PATCH0}
|
||||
|
||||
mkdir -p pcsd/.bundle
|
||||
@ -157,7 +164,7 @@ run_all_tests(){
|
||||
test_result_python=$?
|
||||
|
||||
#remove pcs tests, we do not distribute them in rpm
|
||||
find ${sitelib}/pcs -name test -type d -print0|xargs -0 rm -r -v --
|
||||
find ${sitelib}/pcs -name test -type d -print0|xargs -0 rm -rf -v --
|
||||
|
||||
|
||||
#run pcsd tests and remove them
|
||||
@ -202,6 +209,8 @@ end
|
||||
%systemd_postun_with_restart pcsd.service
|
||||
|
||||
%files
|
||||
%doc README
|
||||
%license COPYING
|
||||
%{python3_sitelib}/pcs
|
||||
%{python3_sitelib}/pcs-%{version}-py3.*.egg-info
|
||||
/usr/sbin/pcs
|
||||
@ -229,10 +238,14 @@ end
|
||||
%exclude %{python3_sitelib}/pcs/pcs.8
|
||||
%exclude %{python3_sitelib}/pcs/pcs
|
||||
|
||||
%doc COPYING README
|
||||
|
||||
%changelog
|
||||
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 0.9.154-3
|
||||
* Wed Jan 04 2017 Adam Williamson <awilliam@redhat.com> - 0.9.155-1
|
||||
- Latest release 0.9.155
|
||||
- Fix tests with Python 3.6 and lxml 3.7
|
||||
- Package the license as license, not doc
|
||||
- Use -f param for rm when wiping test directories as they are nested now
|
||||
|
||||
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com>
|
||||
- Rebuild for Python 3.6
|
||||
|
||||
* Tue Oct 18 2016 Tomas Jelinek <tojeline@redhat.com> - 0.9.154-2
|
||||
|
Loading…
Reference in New Issue
Block a user