Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sidecar tags tests #13502

Merged
merged 5 commits into from
Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,13 @@ public Sidecar updateTaggedConfigurationAssignments(Sidecar sidecar) {
final Set<String> sidecarTags = sidecar.nodeDetails().tags();

// find all configurations that match the tags
// TODO only find configs that match the right collector os
final List<Configuration> taggedConfigs = configurationService.findByTags(sidecarTags);
final Set<String> matchingOsCollectorIds = collectorService.all().stream()
.filter(c -> c.nodeOperatingSystem().equalsIgnoreCase(sidecar.nodeDetails().operatingSystem()))
.map(Collector::id).collect(Collectors.toSet());

final List<ConfigurationAssignment> tagAssigned = taggedConfigs.stream().map(c -> {
final List<ConfigurationAssignment> tagAssigned = taggedConfigs.stream()
.filter(c -> matchingOsCollectorIds.contains(c.collectorId())).map(c -> {
// fill in ConfigurationAssignment.assignedFromTags()
// If we only support one tag on a configuration, this can be simplified
final Set<String> matchedTags = c.tags().stream().filter(sidecarTags::contains).collect(Collectors.toSet());
Expand Down Expand Up @@ -233,10 +236,10 @@ public Sidecar fromRequest(String nodeId, RegistrationRequest request, String co
collectorVersion);
}

public Sidecar applyManualAssignments(String collectorNodeId, List<ConfigurationAssignment> assignments) throws NotFoundException{
Sidecar sidecar = findByNodeId(collectorNodeId);
public Sidecar applyManualAssignments(String sidecarNodeId, List<ConfigurationAssignment> assignments) throws NotFoundException{
Sidecar sidecar = findByNodeId(sidecarNodeId);
if (sidecar == null) {
throw new NotFoundException("Couldn't find collector with ID " + collectorNodeId);
throw new NotFoundException("Couldn't find sidecar with nodeId " + sidecarNodeId);
}
for (ConfigurationAssignment assignment : assignments) {
Collector collector = collectorService.find(assignment.collectorId());
Expand Down

This file was deleted.

Loading