aboutsummaryrefslogtreecommitdiffstats
path: root/tests/archive_tests.py
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2018-07-02 12:01:04 +0100
committerBryn M. Reeves <bmr@redhat.com>2018-07-02 12:01:04 +0100
commitb96bdab03f06408e162b1733b20e8ba9fbf8e012 (patch)
treefa83a8f7987f1995263e9be9e904505f8339d709 /tests/archive_tests.py
parentbe32615f809bf109928c8fb8849cfc794937bf14 (diff)
downloadsos-b96bdab03f06408e162b1733b20e8ba9fbf8e012.tar.gz
[archive] fix add_string()/do_*_sub() regression
A change in the handling of add_string() operations in the archive class causes the Plugin string substitution methods to fail (since the archive was enforcing a check that the path did not already exist - for substitutions this is always the case). Maintain the check for content that is being copied into the archive anew, but make the add_string() method override this and disable the existence checks. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
Diffstat (limited to 'tests/archive_tests.py')
-rw-r--r--tests/archive_tests.py12
1 files changed, 2 insertions, 10 deletions
diff --git a/tests/archive_tests.py b/tests/archive_tests.py
index 76bd912e..b4dd8d0f 100644
--- a/tests/archive_tests.py
+++ b/tests/archive_tests.py
@@ -94,21 +94,13 @@ class TarFileArchiveTest(unittest.TestCase):
self.assertEquals('this is my content', afp.read())
def test_rewrite_file(self):
- """Test that re-writing a file does not modify the content.
-
- In sos we do not have a use for overwriting archive content
- in-place (it is an error if different plugins attempt to
- store different content at the same path).
-
- We do not enforce the content check at runtime since it
- would be prohibitively costly: instead just verify in the
- unit suite that the original content is preserved.
+ """Test that re-writing a file with add_string() modifies the content.
"""
self.tf.add_string('this is my content', 'tests/string_test.txt')
self.tf.add_string('this is my new content', 'tests/string_test.txt')
afp = self.tf.open_file('tests/string_test.txt')
- self.assertEquals('this is my content', afp.read())
+ self.assertEquals('this is my new content', afp.read())
def test_make_link(self):
self.tf.add_file('tests/ziptest')