Fix cookied-dop-sl2 test for monitoring_remote_storage_adapter

- Container 'monitoring_remote_storage_adapter' is now optional
  and exists only with InfluxDB.
- Sync grains before mine.update

Related-issue: #PROD-17502

Change-Id: I1b9e7f530b4ab4f2313495e768c8bf2dbf0e4613
diff --git a/tcp_tests/managers/sl_manager.py b/tcp_tests/managers/sl_manager.py
index 142cd3f..5c1b3a1 100644
--- a/tcp_tests/managers/sl_manager.py
+++ b/tcp_tests/managers/sl_manager.py
@@ -150,7 +150,7 @@
         """
         for node in nodes:
             services_status = self.get_service_info_from_node(node)
-            assert len(services_status) == len(expected_services), \
+            assert set(services_status) >= set(expected_services), \
                 'Some services are missed on node {0}. ' \
                 'Current service list: {1}\nExpected service list: {2}' \
                 .format(node, services_status, expected_services)
diff --git a/tcp_tests/templates/shared-salt.yaml b/tcp_tests/templates/shared-salt.yaml
index 907f8a0..95f207a 100644
--- a/tcp_tests/templates/shared-salt.yaml
+++ b/tcp_tests/templates/shared-salt.yaml
@@ -743,7 +743,9 @@
   skip_fail: false
 
 - description: Update minion information
-  cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' mine.update && sleep 15
+  cmd: |
+    salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_grains &&
+    salt --hard-crash --state-output=mixed --state-verbose=False '*' mine.update && sleep 15
   node_name: {{ HOSTNAME_CFG01 }}
   retry: {count: 1, delay: 10}
   skip_fail: false
diff --git a/tcp_tests/tests/system/test_install_cookied_ocata.py b/tcp_tests/tests/system/test_install_cookied_ocata.py
index 0678365..58a7e12 100644
--- a/tcp_tests/tests/system/test_install_cookied_ocata.py
+++ b/tcp_tests/tests/system/test_install_cookied_ocata.py
@@ -58,7 +58,8 @@
 
     @pytest.mark.grab_versions
     @pytest.mark.fail_snapshot
-    def test_cookied_ocata_cicd_oss_install(self, underlay, openstack_deployed,
+    def test_cookied_ocata_cicd_oss_install(self, underlay, salt_actions,
+                                            openstack_deployed,
                                             oss_deployed, sl_deployed,
                                             show_step):
         """Test for deploying an mcp environment and check it
@@ -79,8 +80,7 @@
             openstack_deployed.run_tempest(pattern=settings.PATTERN)
             openstack_deployed.download_tempest_report()
 
-        expected_service_list = ['monitoring_remote_storage_adapter',
-                                 'monitoring_server',
+        expected_service_list = ['monitoring_server',
                                  'monitoring_remote_agent',
                                  'dashboard_grafana',
                                  'monitoring_alertmanager',
@@ -91,6 +91,13 @@
         LOG.debug('Mon nodes list {0}'.format(mon_nodes))
 
         show_step(7)
+        prometheus_relay_enabled = salt_actions.get_pillar(
+            tgt=mon_nodes[0],
+            pillar="prometheus:relay:enabled")[0]
+        if not prometheus_relay_enabled:
+            # InfluxDB is used if prometheus relay service is not installed
+            expected_service_list.append('monitoring_remote_storage_adapter')
+
         sl_deployed.check_docker_services(mon_nodes, expected_service_list)
 
         show_step(8)