From e906bca5f5f2c146dcc0492c932ea3e8a399cfe7 Mon Sep 17 00:00:00 2001 From: Marco Pfatschbacher Date: Wed, 21 Sep 2022 17:32:07 +0200 Subject: [PATCH] Sidecar tags tests (#13502) * Only assign tagged configs that match the OS * rename test * add tests for SidecarService.updateTaggedConfigurationAssignments() * add tests for SidecarService.applyManualAssignments() --- .../sidecar/services/SidecarService.java | 13 +- .../collectors/SidecarServiceImplTest.java | 169 -------- .../collectors/SidecarServiceTest.java | 381 ++++++++++++++++++ .../collectors/collectorsSingleDataset.json | 14 - .../plugins/sidecar/collectors/sidecars.json | 16 + 5 files changed, 405 insertions(+), 188 deletions(-) delete mode 100644 graylog2-server/src/test/java/org/graylog/plugins/sidecar/collectors/SidecarServiceImplTest.java create mode 100644 graylog2-server/src/test/java/org/graylog/plugins/sidecar/collectors/SidecarServiceTest.java delete mode 100644 graylog2-server/src/test/resources/org/graylog/plugins/sidecar/collectors/collectorsSingleDataset.json create mode 100644 graylog2-server/src/test/resources/org/graylog/plugins/sidecar/collectors/sidecars.json diff --git a/graylog2-server/src/main/java/org/graylog/plugins/sidecar/services/SidecarService.java b/graylog2-server/src/main/java/org/graylog/plugins/sidecar/services/SidecarService.java index 8675cea6994a..4c886ea10007 100644 --- a/graylog2-server/src/main/java/org/graylog/plugins/sidecar/services/SidecarService.java +++ b/graylog2-server/src/main/java/org/graylog/plugins/sidecar/services/SidecarService.java @@ -101,10 +101,13 @@ public Sidecar updateTaggedConfigurationAssignments(Sidecar sidecar) { final Set sidecarTags = sidecar.nodeDetails().tags(); // find all configurations that match the tags - // TODO only find configs that match the right collector os final List taggedConfigs = configurationService.findByTags(sidecarTags); + final Set matchingOsCollectorIds = collectorService.all().stream() + .filter(c -> c.nodeOperatingSystem().equalsIgnoreCase(sidecar.nodeDetails().operatingSystem())) + .map(Collector::id).collect(Collectors.toSet()); - final List tagAssigned = taggedConfigs.stream().map(c -> { + final List 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 matchedTags = c.tags().stream().filter(sidecarTags::contains).collect(Collectors.toSet()); @@ -233,10 +236,10 @@ public Sidecar fromRequest(String nodeId, RegistrationRequest request, String co collectorVersion); } - public Sidecar applyManualAssignments(String collectorNodeId, List assignments) throws NotFoundException{ - Sidecar sidecar = findByNodeId(collectorNodeId); + public Sidecar applyManualAssignments(String sidecarNodeId, List 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()); diff --git a/graylog2-server/src/test/java/org/graylog/plugins/sidecar/collectors/SidecarServiceImplTest.java b/graylog2-server/src/test/java/org/graylog/plugins/sidecar/collectors/SidecarServiceImplTest.java deleted file mode 100644 index 270250ac6e1f..000000000000 --- a/graylog2-server/src/test/java/org/graylog/plugins/sidecar/collectors/SidecarServiceImplTest.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (C) 2020 Graylog, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the Server Side Public License, version 1, - * as published by MongoDB, Inc. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * Server Side Public License for more details. - * - * You should have received a copy of the Server Side Public License - * along with this program. If not, see - * . - */ -package org.graylog.plugins.sidecar.collectors; - -import com.mongodb.client.MongoCollection; -import org.bson.Document; -import org.graylog.plugins.sidecar.rest.models.NodeDetails; -import org.graylog.plugins.sidecar.rest.models.Sidecar; -import org.graylog.plugins.sidecar.services.CollectorService; -import org.graylog.plugins.sidecar.services.ConfigurationService; -import org.graylog.plugins.sidecar.services.SidecarService; -import org.graylog.testing.inject.TestPasswordSecretModule; -import org.graylog.testing.mongodb.MongoDBFixtures; -import org.graylog.testing.mongodb.MongoDBInstance; -import org.graylog2.bindings.providers.MongoJackObjectMapperProvider; -import org.graylog2.shared.bindings.ObjectMapperModule; -import org.graylog2.shared.bindings.ValidatorModule; -import org.jukito.JukitoRunner; -import org.jukito.UseModules; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.junit.MockitoJUnit; -import org.mockito.junit.MockitoRule; - -import javax.validation.Validator; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -@RunWith(JukitoRunner.class) -@UseModules({ObjectMapperModule.class, ValidatorModule.class, TestPasswordSecretModule.class}) -public class SidecarServiceImplTest { - private static final String collectionName = "sidecars"; - - @Rule - public final MockitoRule mockitoRule = MockitoJUnit.rule(); - @Mock - private CollectorService collectorService; - - @Mock private ConfigurationService configurationService; - - @Rule - public final MongoDBInstance mongodb = MongoDBInstance.createForClass(); - - private SidecarService sidecarService; - - @Before - public void setUp(MongoJackObjectMapperProvider mapperProvider, - Validator validator) throws Exception { - this.sidecarService = new SidecarService(collectorService, configurationService, mongodb.mongoConnection(), mapperProvider, validator); - } - - @Test - public void testCountEmptyCollection() throws Exception { - final long result = this.sidecarService.count(); - - assertEquals(0, result); - } - - @Test - @MongoDBFixtures("collectorsMultipleDocuments.json") - public void testCountNonEmptyCollection() throws Exception { - final long result = this.sidecarService.count(); - - assertEquals(3, result); - } - - @Test - public void testSaveFirstRecord() throws Exception { - String nodeId = "nodeId"; - String nodeName = "nodeName"; - String version = "0.0.1"; - String os = "DummyOS 1.0"; - final Sidecar sidecar = Sidecar.create( - nodeId, - nodeName, - NodeDetails.create( - os, - null, - null, - null, - null, - null, - null), - version - ); - - final Sidecar result = this.sidecarService.save(sidecar); - MongoCollection collection = mongodb.mongoConnection().getMongoDatabase().getCollection(collectionName); - Document document = collection.find().first(); - Document nodeDetails = document.get("node_details", Document.class); - - assertNotNull(result); - assertEquals(nodeId, document.get("node_id")); - assertEquals(nodeName, document.get("node_name")); - assertEquals(version, document.get("sidecar_version")); - assertEquals(os, nodeDetails.get("operating_system")); - } - - @Test - @MongoDBFixtures("collectorsMultipleDocuments.json") - public void testAll() throws Exception { - final List sidecars = this.sidecarService.all(); - - assertNotNull(sidecars); - assertEquals(3, sidecars.size()); - } - - @Test - public void testAllEmptyCollection() throws Exception { - final List sidecars = this.sidecarService.all(); - - assertNotNull(sidecars); - assertEquals(0, sidecars.size()); - } - - @Test - @MongoDBFixtures("collectorsMultipleDocuments.json") - public void testFindById() throws Exception { - final String collector1id = "uniqueid1"; - - final Sidecar sidecar = this.sidecarService.findByNodeId(collector1id); - - assertNotNull(sidecar); - assertEquals(collector1id, sidecar.nodeId()); - } - - @Test - @MongoDBFixtures("collectorsMultipleDocuments.json") - public void testFindByIdNonexisting() throws Exception { - final String collector1id = "nonexisting"; - - final Sidecar sidecar = this.sidecarService.findByNodeId(collector1id); - - assertNull(sidecar); - } - - @Test - @MongoDBFixtures("collectorsMultipleDocuments.json") - public void testDestroy() throws Exception { - final Sidecar sidecar = mock(Sidecar.class); - when(sidecar.id()).thenReturn("581b3bff8e4dc4270055dfcb"); - - final int result = this.sidecarService.delete(sidecar.id()); - assertEquals(1, result); - assertEquals(2, mongodb.mongoConnection().getMongoDatabase().getCollection(collectionName).countDocuments()); - } -} diff --git a/graylog2-server/src/test/java/org/graylog/plugins/sidecar/collectors/SidecarServiceTest.java b/graylog2-server/src/test/java/org/graylog/plugins/sidecar/collectors/SidecarServiceTest.java new file mode 100644 index 000000000000..5240e1753ba5 --- /dev/null +++ b/graylog2-server/src/test/java/org/graylog/plugins/sidecar/collectors/SidecarServiceTest.java @@ -0,0 +1,381 @@ +/* + * Copyright (C) 2020 Graylog, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the Server Side Public License, version 1, + * as published by MongoDB, Inc. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * Server Side Public License for more details. + * + * You should have received a copy of the Server Side Public License + * along with this program. If not, see + * . + */ +package org.graylog.plugins.sidecar.collectors; + +import com.mongodb.client.MongoCollection; +import org.bson.Document; +import org.graylog.plugins.sidecar.rest.models.Collector; +import org.graylog.plugins.sidecar.rest.models.Configuration; +import org.graylog.plugins.sidecar.rest.models.NodeDetails; +import org.graylog.plugins.sidecar.rest.models.Sidecar; +import org.graylog.plugins.sidecar.rest.requests.ConfigurationAssignment; +import org.graylog.plugins.sidecar.services.CollectorService; +import org.graylog.plugins.sidecar.services.ConfigurationService; +import org.graylog.plugins.sidecar.services.SidecarService; +import org.graylog.testing.inject.TestPasswordSecretModule; +import org.graylog.testing.mongodb.MongoDBFixtures; +import org.graylog.testing.mongodb.MongoDBInstance; +import org.graylog2.bindings.providers.MongoJackObjectMapperProvider; +import org.graylog2.database.NotFoundException; +import org.graylog2.shared.bindings.ObjectMapperModule; +import org.graylog2.shared.bindings.ValidatorModule; +import org.jukito.JukitoRunner; +import org.jukito.UseModules; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnit; +import org.mockito.junit.MockitoRule; + +import javax.validation.Validator; +import java.util.List; +import java.util.Set; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.mockito.ArgumentMatchers.anySet; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +@RunWith(JukitoRunner.class) +@UseModules({ObjectMapperModule.class, ValidatorModule.class, TestPasswordSecretModule.class}) +public class SidecarServiceTest { + private static final String collectionName = "sidecars"; + + @Rule + public final MockitoRule mockitoRule = MockitoJUnit.rule(); + @Mock + private CollectorService collectorService; + + @Mock private ConfigurationService configurationService; + + @Rule + public final MongoDBInstance mongodb = MongoDBInstance.createForClass(); + + private SidecarService sidecarService; + + @Before + public void setUp(MongoJackObjectMapperProvider mapperProvider, + Validator validator) throws Exception { + this.sidecarService = new SidecarService(collectorService, configurationService, mongodb.mongoConnection(), mapperProvider, validator); + } + + @Test + public void testCountEmptyCollection() throws Exception { + final long result = this.sidecarService.count(); + + assertEquals(0, result); + } + + @Test + @MongoDBFixtures("collectorsMultipleDocuments.json") + public void testCountNonEmptyCollection() throws Exception { + final long result = this.sidecarService.count(); + + assertEquals(3, result); + } + + @Test + public void testSaveFirstRecord() throws Exception { + String nodeId = "nodeId"; + String nodeName = "nodeName"; + String version = "0.0.1"; + String os = "DummyOS 1.0"; + final Sidecar sidecar = Sidecar.create( + nodeId, + nodeName, + NodeDetails.create( + os, + null, + null, + null, + null, + null, + null), + version + ); + + final Sidecar result = this.sidecarService.save(sidecar); + MongoCollection collection = mongodb.mongoConnection().getMongoDatabase().getCollection(collectionName); + Document document = collection.find().first(); + Document nodeDetails = document.get("node_details", Document.class); + + assertNotNull(result); + assertEquals(nodeId, document.get("node_id")); + assertEquals(nodeName, document.get("node_name")); + assertEquals(version, document.get("sidecar_version")); + assertEquals(os, nodeDetails.get("operating_system")); + } + + @Test + @MongoDBFixtures("collectorsMultipleDocuments.json") + public void testAll() throws Exception { + final List sidecars = this.sidecarService.all(); + + assertNotNull(sidecars); + assertEquals(3, sidecars.size()); + } + + @Test + public void testAllEmptyCollection() throws Exception { + final List sidecars = this.sidecarService.all(); + + assertNotNull(sidecars); + assertEquals(0, sidecars.size()); + } + + @Test + @MongoDBFixtures("collectorsMultipleDocuments.json") + public void testFindById() throws Exception { + final String collector1id = "uniqueid1"; + + final Sidecar sidecar = this.sidecarService.findByNodeId(collector1id); + + assertNotNull(sidecar); + assertEquals(collector1id, sidecar.nodeId()); + } + + @Test + @MongoDBFixtures("collectorsMultipleDocuments.json") + public void testFindByIdNonexisting() throws Exception { + final String collector1id = "nonexisting"; + + final Sidecar sidecar = this.sidecarService.findByNodeId(collector1id); + + assertNull(sidecar); + } + + @Test + @MongoDBFixtures("collectorsMultipleDocuments.json") + public void testDestroy() throws Exception { + final Sidecar sidecar = mock(Sidecar.class); + when(sidecar.id()).thenReturn("581b3bff8e4dc4270055dfcb"); + + final int result = this.sidecarService.delete(sidecar.id()); + assertEquals(1, result); + assertEquals(2, mongodb.mongoConnection().getMongoDatabase().getCollection(collectionName).countDocuments()); + } + + @Test + public void simpleTagAssignment() { + final Configuration configuration = getConfiguration(); + when(configurationService.findByTags(anySet())).thenReturn(List.of(configuration)); + final Collector collector = getCollector(); + + when(collectorService.all()).thenReturn(List.of(collector)); + Sidecar sidecar = getTestSidecar(); + sidecar = sidecar.toBuilder().nodeDetails(getNodeDetails("linux", Set.of("tag1"))).build(); + + sidecar = sidecarService.updateTaggedConfigurationAssignments(sidecar); + + assertThat(sidecar.assignments()).hasSize(1); + assertThat(sidecar.assignments().get(0).assignedFromTags()).isEqualTo(Set.of("tag1")); + } + + @Test + public void mergeWithManualAssignments() { + final Configuration configuration = getConfiguration(); + when(configurationService.findByTags(anySet())).thenReturn(List.of(configuration)); + final Collector collector = getCollector(); + + when(collectorService.all()).thenReturn(List.of(collector)); + Sidecar sidecar = getTestSidecar(); + sidecar = sidecar.toBuilder().nodeDetails(getNodeDetails("linux", Set.of("tag1"))) + .assignments(List.of(ConfigurationAssignment.create("some collector", "some config", null))) + .build(); + + sidecar = sidecarService.updateTaggedConfigurationAssignments(sidecar); + + assertThat(sidecar.assignments()).hasSize(2); + assertThat(sidecar.assignments()).satisfies(assignments -> { + assertThat(assignments.stream().filter(a -> a.assignedFromTags().equals(Set.of())).findAny()).isPresent(); + assertThat(assignments.stream().filter(a -> a.assignedFromTags().equals(Set.of("tag1"))).findAny()).isPresent(); + }); + } + + @Test + public void updateExistingAssignment() { + final Configuration configuration = getConfiguration(); + when(configurationService.findByTags(anySet())).thenReturn(List.of(configuration)); + final Collector collector = getCollector(); + + when(collectorService.all()).thenReturn(List.of(collector)); + Sidecar sidecar = getTestSidecar(); + final ConfigurationAssignment existingAssignment = ConfigurationAssignment.create(collector.id(), configuration.id(), Set.of("tag1")); + sidecar = sidecar.toBuilder().nodeDetails(getNodeDetails("linux", Set.of("tag1"))) + .assignments(List.of(existingAssignment)) + .build(); + + sidecar = sidecarService.updateTaggedConfigurationAssignments(sidecar); + + assertThat(sidecar.assignments()).hasSize(1); + assertThat(sidecar.assignments()).first().isEqualTo(existingAssignment); + } + + @Test + public void updateExistingAssignments() { + final Configuration configuration = getConfiguration(); + when(configurationService.findByTags(anySet())).thenReturn(List.of(configuration)); + final Collector collector = getCollector(); + + when(collectorService.all()).thenReturn(List.of(collector)); + Sidecar sidecar = getTestSidecar(); + final ConfigurationAssignment existingTag3Assignment = ConfigurationAssignment.create(collector.id(), configuration.id(), Set.of("tag3")); + final ConfigurationAssignment existingManualAssignment = ConfigurationAssignment.create("some-collector", "some-config", null); + sidecar = sidecar.toBuilder().nodeDetails(getNodeDetails("linux", Set.of("tag1"))) + .assignments(List.of(existingTag3Assignment, existingManualAssignment)) + .build(); + + sidecar = sidecarService.updateTaggedConfigurationAssignments(sidecar); + + assertThat(sidecar.assignments()).hasSize(2); + assertThat(sidecar.assignments()).satisfies(assignments -> { + assertThat(assignments.stream().filter(a -> a.assignedFromTags().equals(Set.of())).findAny()).isPresent(); + assertThat(assignments.stream().filter(a -> a.assignedFromTags().equals(Set.of("tag3"))).findAny()).isEmpty(); + assertThat(assignments.stream().filter(a -> a.assignedFromTags().equals(Set.of("tag1"))).findAny()).isPresent(); + }); + } + + @Test + public void ignoresTagsWithWrongOS() { + final Configuration configuration = getConfiguration(); + when(configurationService.findByTags(anySet())).thenReturn(List.of(configuration)); + final Collector collector = getCollector(); + + when(collectorService.all()).thenReturn(List.of(collector)); + Sidecar sidecar = getTestSidecar(); + sidecar = sidecar.toBuilder().nodeDetails(getNodeDetails("windows", Set.of("tag1"))).build(); + + sidecar = sidecarService.updateTaggedConfigurationAssignments(sidecar); + + // The tagged config is linux only + assertThat(sidecar.assignments()).hasSize(0); + } + + @Test + public void replacesManualAssignmentsWithTaggedOnes() { + final Configuration configuration = getConfiguration(); + when(configurationService.findByTags(anySet())).thenReturn(List.of(configuration)); + final Collector collector = getCollector(); + + when(collectorService.all()).thenReturn(List.of(collector)); + Sidecar sidecar = getTestSidecar(); + final ConfigurationAssignment manualAssignment = ConfigurationAssignment.create(collector.id(), configuration.id(), null); + sidecar = sidecar.toBuilder().nodeDetails(getNodeDetails("linux", Set.of("tag1"))) + .assignments(List.of(manualAssignment)) + .build(); + + sidecar = sidecarService.updateTaggedConfigurationAssignments(sidecar); + + assertThat(sidecar.assignments()).hasSize(1); + assertThat(sidecar.assignments()).satisfies(assignments -> { + assertThat(assignments.stream().filter(a -> a.assignedFromTags().equals(Set.of("tag1"))).findAny()).isPresent(); + }); + } + + @Test + @MongoDBFixtures("sidecars.json") + public void applyManualAssignment() throws NotFoundException { + Sidecar sidecar = sidecarService.findByNodeId("node-id"); + + final Configuration configuration = getConfiguration(); + when(configurationService.find(anyString())).thenReturn(configuration); + final Collector collector = getCollector(); + when(collectorService.find(anyString())).thenReturn(collector); + + assertThat(sidecar.assignments()).isEmpty(); + final ConfigurationAssignment manualAssignment = ConfigurationAssignment.create(collector.id(), configuration.id(), null); + sidecar = sidecarService.applyManualAssignments(sidecar.nodeId(), List.of(manualAssignment)); + + assertThat(sidecar.assignments()).hasSize(1); + } + + @Test + @MongoDBFixtures("sidecars.json") + public void applyManualAssignmentKeepTagged() throws NotFoundException { + Sidecar sidecar = sidecarService.findByNodeId("node-id"); + final ConfigurationAssignment taggedAssignment = ConfigurationAssignment.create("some-collector", "some-config", Set.of("tag")); + sidecar = sidecarService.save(sidecar.toBuilder().assignments(List.of(taggedAssignment)).build()); + + final Configuration configuration = getConfiguration(); + when(configurationService.find(anyString())).thenReturn(configuration); + final Collector collector = getCollector(); + when(collectorService.find(anyString())).thenReturn(collector); + + assertThat(sidecar.assignments()).hasSize(1); + final ConfigurationAssignment manualAssignment = ConfigurationAssignment.create(collector.id(), configuration.id(), null); + sidecar = sidecarService.applyManualAssignments(sidecar.nodeId(), List.of(manualAssignment)); + + assertThat(sidecar.assignments()).hasSize(2); + } + + @Test + @MongoDBFixtures("sidecars.json") + public void ignoreModificationOfTaggedAssignments() throws NotFoundException { + Sidecar sidecar = sidecarService.findByNodeId("node-id"); + + final Configuration configuration = getConfiguration(); + when(configurationService.find(anyString())).thenReturn(configuration); + final Collector collector = getCollector(); + when(collectorService.find(anyString())).thenReturn(collector); + final ConfigurationAssignment taggedAssignment = ConfigurationAssignment.create(collector.id(), configuration.id(), Set.of("tag")); + sidecar = sidecarService.save(sidecar.toBuilder().assignments(List.of(taggedAssignment)).build()); + + + assertThat(sidecar.assignments()).hasSize(1); + final ConfigurationAssignment manualAssignment = ConfigurationAssignment.create(collector.id(), configuration.id(), null); + sidecar = sidecarService.applyManualAssignments(sidecar.nodeId(), List.of(manualAssignment)); + + assertThat(sidecar.assignments()).hasSize(1); + // Tagged assignment is kept intact + assertThat(sidecar.assignments().get(0).assignedFromTags()).isEqualTo(Set.of("tag")); + } + + private static Configuration getConfiguration() { + return Configuration.create("config-id", "collector-id", "config-name", "color", "template", Set.of("tag1")); + } + + private static Collector getCollector() { + return Collector.create("collector-id", "collector-name", "service", "linux", + "/path", "param", "valid param", ""); + } + + private Sidecar getTestSidecar() { + return Sidecar.create( + "node-id", + "node-name", + getNodeDetails("linux", null), + "1.3.0" + ); + } + + private NodeDetails getNodeDetails(String os, Set tags) { + return NodeDetails.create( + os, + null, + null, + null, + null, + tags, + null); + } +} diff --git a/graylog2-server/src/test/resources/org/graylog/plugins/sidecar/collectors/collectorsSingleDataset.json b/graylog2-server/src/test/resources/org/graylog/plugins/sidecar/collectors/collectorsSingleDataset.json deleted file mode 100644 index 6b906729885d..000000000000 --- a/graylog2-server/src/test/resources/org/graylog/plugins/sidecar/collectors/collectorsSingleDataset.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "sidecars": [ - { - "_id": "581b3bff8e4dc4270055dfcb", - "node_id": "nodeId", - "node_name": "nodeName", - "sidecar_version": "0.0.1", - "node_details": { - "operating_system": "DummyOS 1.0" - }, - "last_seen": "" - } - ] -} diff --git a/graylog2-server/src/test/resources/org/graylog/plugins/sidecar/collectors/sidecars.json b/graylog2-server/src/test/resources/org/graylog/plugins/sidecar/collectors/sidecars.json new file mode 100644 index 000000000000..d47fc9369ac3 --- /dev/null +++ b/graylog2-server/src/test/resources/org/graylog/plugins/sidecar/collectors/sidecars.json @@ -0,0 +1,16 @@ +{ + "sidecars": [ + { + "_id": { + "$oid": "581b3bff8e4dc4270055dfcb" + }, + "node_id": "node-id", + "node_name": "node-name", + "sidecar_version": "1.3.0", + "node_details": { + "operating_system": "linux" + }, + "last_seen": "2015-04-01T11:50:20.195Z" + } + ] +}