##### SUMMARY

Support collection roles as integration test targets.

Now that https://github.com/ansible/ansible/issues/59462 has been merged, ansible-test can be updated to support running integration test targets that are collection roles.

The planned convention is to look for targets under `roles/test/` and allow use of target-specific plugins from `plugins/{plugin_type}/test/{target_name}/`.

##### ISSUE TYPE

Feature Idea

##### COMPONENT NAME

ansible-test

##### ADDITIONAL INFORMATION

This will allow integration test targets to be written using collections instead of pre-collection roles.
"""Return True if the given path is a content root for this provider."""
        if os.path.basename(os.path.dirname(os.path.dirname(path))) == 'ansible_collections':
            return True
        return False
    def create(self, root, paths):  
        """Create a Layout using the given root and paths."""
        plugin_paths = dict((p, os.path.join('plugins', p)) for p in self.PLUGIN_TYPES)
        collection_root = os.path.dirname(os.path.dirname(root))
        collection_dir = os.path.relpath(root, collection_root)
        collection_namespace, collection_name = collection_dir.split(os.sep)
        collection_root = os.path.dirname(collection_root)
        return ContentLayout(root,
                             paths,
                             plugin_paths=plugin_paths,
                             collection=CollectionDetail(
                                 name=collection_name,
                                 namespace=collection_namespace,
                                 root=collection_root,
                             ),
                             test_path='tests',
                             results_path='tests/output',
                             sanity_path='tests/sanity',
                             integration_path='tests/integration',
                             integration_targets_path='tests/integration/targets',
                             integration_vars_path='tests/integration/integration_config.yml',
                             unit_path='tests/unit',
                             unit_module_path='tests/unit/plugins/modules',
                             unit_module_utils_path='tests/unit/plugins/module_utils',
                             )