Commit 457905fe authored by Xavier Thompson's avatar Xavier Thompson

software/matomo: Adapt to changes in stack/lamp

Database password is now randomly generated.
Now test that the pre-filled password matches the mariadb url.
parent f7dd420b
...@@ -35,7 +35,6 @@ path = ${template-matomo-instance:output} ...@@ -35,7 +35,6 @@ path = ${template-matomo-instance:output}
part-list = matomo-backup.sh matomo-backup-cron part-list = matomo-backup.sh matomo-backup-cron
db-name = matomo db-name = matomo
db-user = matomo db-user = matomo
db-password = 12345678
[template-matomo-instance] [template-matomo-instance]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
......
...@@ -52,6 +52,9 @@ class MatomoTestCase(SlapOSInstanceTestCase): ...@@ -52,6 +52,9 @@ class MatomoTestCase(SlapOSInstanceTestCase):
break break
self.assertTrue(self.matomo_path,"matomo path not found in %r" % (partition_path_list,)) self.assertTrue(self.matomo_path,"matomo path not found in %r" % (partition_path_list,))
self.connection_parameters = self.computer_partition.getConnectionParameterDict() self.connection_parameters = self.computer_partition.getConnectionParameterDict()
# parse <url> out of ['<url>']
url = self.connection_parameters['mariadb-url-list'][2:-2]
self.db_info = urllib.parse.urlparse(url)
#Check if matomo root directory is empty #Check if matomo root directory is empty
def test_matomo_dir(self): def test_matomo_dir(self):
...@@ -83,8 +86,9 @@ class MatomoTestCase(SlapOSInstanceTestCase): ...@@ -83,8 +86,9 @@ class MatomoTestCase(SlapOSInstanceTestCase):
self.assertEqual( self.assertEqual(
tree.xpath('//input[@name="dbname"]/@value'), tree.xpath('//input[@name="dbname"]/@value'),
['matomo']) ['matomo'])
self.assertTrue( self.assertEqual(
tree.xpath('//input[@name="password"]/@value')[0]) tree.xpath('//input[@name="password"]/@value'),
[self.db_info.password])
self.assertEqual( self.assertEqual(
tree.xpath('//input[@name="host"]/@value'), tree.xpath('//input[@name="host"]/@value'),
[f'{self._ipv4_address}:2099'] [f'{self._ipv4_address}:2099']
......
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