def check_ci_group(self, targets, find): """ :type targets: tuple[CompletionTarget] :type find: str :rtype: list[SanityMessage] """ all_paths = set(t.path for t in targets) supported_paths = set(t.path for t in filter_targets(targets, [find], include=True, directories=False, errors=False)) unsupported_paths = set(t.path for t in filter_targets(targets, [self.UNSUPPORTED], include=True, directories=False, errors=False)) unassigned_paths = all_paths - supported_paths - unsupported_paths conflicting_paths = supported_paths & unsupported_paths unassigned_message = 'missing alias `%s` or `%s`' % (find.strip('/'), self.UNSUPPORTED.strip('/')) conflicting_message = 'conflicting alias `%s` and `%s`' % (find.strip('/'), self.UNSUPPORTED.strip('/')) messages = [] for path in unassigned_paths: messages.append(SanityMessage(unassigned_message, '%s/aliases' % path)) for path in conflicting_paths: messages.append(SanityMessage(conflicting_message, '%s/aliases' % path)) return messages
def check_ci_group(self, targets, find): """ :type targets: tuple[CompletionTarget] :type find: str :rtype: list[SanityMessage] """ all_paths = set(t.path for t in targets) supported_paths = set(t.path for t in filter_targets( targets, [find], include=True, directories=False, errors=False)) unsupported_paths = set( t.path for t in filter_targets(targets, [self.UNSUPPORTED], include=True, directories=False, errors=False)) unassigned_paths = all_paths - supported_paths - unsupported_paths conflicting_paths = supported_paths & unsupported_paths unassigned_message = 'missing alias `%s` or `%s`' % ( find.strip('/'), self.UNSUPPORTED.strip('/')) conflicting_message = 'conflicting alias `%s` and `%s`' % ( find.strip('/'), self.UNSUPPORTED.strip('/')) messages = [] for path in unassigned_paths: messages.append( SanityMessage(unassigned_message, '%s/aliases' % path)) for path in conflicting_paths: messages.append( SanityMessage(conflicting_message, '%s/aliases' % path)) return messages
def check_posix_targets(self, args): """ :type args: SanityConfig :rtype: list[SanityMessage] """ posix_targets = tuple(walk_posix_integration_targets()) clouds = get_cloud_platforms(args, posix_targets) cloud_targets = ['cloud/%s/' % cloud for cloud in clouds] all_cloud_targets = tuple(filter_targets(posix_targets, ['cloud/'], include=True, directories=False, errors=False)) invalid_cloud_targets = tuple(filter_targets(all_cloud_targets, cloud_targets, include=False, directories=False, errors=False)) messages = [] for target in invalid_cloud_targets: for alias in target.aliases: if alias.startswith('cloud/') and alias != 'cloud/': if any(alias.startswith(cloud_target) for cloud_target in cloud_targets): continue messages.append(SanityMessage('invalid alias `%s`' % alias, '%s/aliases' % target.path)) messages += self.check_ci_group( targets=tuple(filter_targets(posix_targets, ['cloud/'], include=False, directories=False, errors=False)), find='posix/ci/group[1-3]/', ) for cloud in clouds: messages += self.check_ci_group( targets=tuple(filter_targets(posix_targets, ['cloud/%s/' % cloud], include=True, directories=False, errors=False)), find='posix/ci/cloud/group[1-5]/%s/' % cloud, ) return messages