Add test ability to instances_mapped_to_cell

Related-issue: https://mirantis.jira.com/browse/PROD-26861
Change-Id: I5a4898390379f2f99a7c37fc300cb555519774ab
diff --git a/_states/novav21.py b/_states/novav21.py
index ffda7d1..ad8a4a5 100644
--- a/_states/novav21.py
+++ b/_states/novav21.py
@@ -466,6 +466,7 @@
     :param timeout: amount of time in seconds mapping process should finish in.
     :param runas: username to run the shell commands under.
     """
+    test = __opts__.get('test', False)
     cell_uuid = __salt__['cmd.shell'](
         "nova-manage cell_v2 list_cells 2>/dev/null | "
         "awk '/%s/ {print $4}'" % name, runas=runas)
@@ -476,17 +477,21 @@
             .format(name))
         return result
     start_time = time.time()
-    while True:
-        rc = __salt__['cmd.retcode']('nova-manage cell_v2 map_instances '
-                                     '--cell_uuid %s' % cell_uuid, runas=runas)
-        if rc == 0 or time.time() - start_time > timeout:
-            break
-    if rc != 0:
-        result['comment'] = (
-            'Failed to map all instances in cell {0} in {1} seconds'
-            .format(name, timeout))
-        return result
+    if not test:
+        while True:
+            rc = __salt__['cmd.retcode'](
+                'nova-manage cell_v2 map_instances --cell_uuid %s' % cell_uuid,
+                runas=runas)
+            if rc == 0 or time.time() - start_time > timeout:
+                break
+        if rc != 0:
+            result['comment'] = (
+                'Failed to map all instances in cell {0} in {1} seconds'
+                .format(name, timeout))
+            return result
     result['comment'] = 'All instances mapped in cell {0}'.format(name)
+    if test:
+        result['comment'] = 'TEST: {}'.format(result['comment'])
     result['result'] = True
     return result