Commit 52a57d87 authored by Łukasz Nowak's avatar Łukasz Nowak

caddy-frontend: Stabilise SAVE_TEST_RESULT with hash

Improves 57bdf689 by having stored and
expected values stable across runs.

Also assertion is done with {hash} instead its real value, as it has no
meaning to test user.
parent 004a47dc
...@@ -114,7 +114,7 @@ class TestDataMixin(object): ...@@ -114,7 +114,7 @@ class TestDataMixin(object):
'%(group)s:%(name)s %(statename)s' % q for q '%(group)s:%(name)s %(statename)s' % q for q
in self.getSupervisorRPCServer().supervisor.getAllProcessInfo()])) in self.getSupervisorRPCServer().supervisor.getAllProcessInfo()]))
def assertTestData(self, runtime_data, **kw): def assertTestData(self, runtime_data, hash_value=None):
filename = '%s-%s.txt' % (self.id(), 'CADDY') filename = '%s-%s.txt' % (self.id(), 'CADDY')
test_data_file = os.path.join( test_data_file = os.path.join(
os.path.dirname(os.path.realpath(__file__)), 'test_data', filename) os.path.dirname(os.path.realpath(__file__)), 'test_data', filename)
...@@ -124,8 +124,8 @@ class TestDataMixin(object): ...@@ -124,8 +124,8 @@ class TestDataMixin(object):
except IOError: except IOError:
test_data = '' test_data = ''
if len(kw) > 0: if hash_value is not None:
test_data = test_data.format(**kw) runtime_data = runtime_data.replace(hash_value, '{hash}')
maxDiff = self.maxDiff maxDiff = self.maxDiff
self.maxDiff = None self.maxDiff = None
...@@ -209,7 +209,7 @@ class TestDataMixin(object): ...@@ -209,7 +209,7 @@ class TestDataMixin(object):
h = self.generateHashFromFiles(hash_files) h = self.generateHashFromFiles(hash_files)
runtime_data = self.getTrimmedProcessInfo() runtime_data = self.getTrimmedProcessInfo()
self.assertTestData(runtime_data, hash=h) self.assertTestData(runtime_data, hash_value=h)
class HttpFrontendTestCase(SlapOSInstanceTestCase): class HttpFrontendTestCase(SlapOSInstanceTestCase):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment