diff options
-rw-r--r-- | netconfsimulator/README.md | 4 | ||||
-rw-r--r-- | netconfsimulator/netconf/yang_loader.log | 1 | ||||
-rw-r--r-- | netconfsimulator/pom.xml | 76 | ||||
-rw-r--r-- | netconfsimulator/src/it/java/integration/NetconfFunctionsIT.java (renamed from netconfsimulator/src/test/java/integration/NetconfFunctionsIT.java) | 15 | ||||
-rw-r--r-- | netconfsimulator/src/it/java/integration/NetconfSimulatorClient.java (renamed from netconfsimulator/src/test/java/integration/NetconfSimulatorClient.java) | 0 |
5 files changed, 67 insertions, 29 deletions
diff --git a/netconfsimulator/README.md b/netconfsimulator/README.md index 98397a9..701e3db 100644 --- a/netconfsimulator/README.md +++ b/netconfsimulator/README.md @@ -316,8 +316,8 @@ response: ### Integration tests Integration tests use docker-compose for setting up cluster with all services. -Those tests are not part of build pipeline, but can be run manually by invoking *mvn verify -DskipITs=false* from project command line. -Tests can be found in netconfsimulator project in src/integration directory. +Those tests are not part of build pipeline, but can be run manually by invoking *mvn clean verify -P integration* from project command line. +Tests can be found in netconfsimulator project in src/it directory. ## Troubleshooting Q: Simulator throws errors after shutting down with *docker-compose down* or *docker-compose restart* diff --git a/netconfsimulator/netconf/yang_loader.log b/netconfsimulator/netconf/yang_loader.log deleted file mode 100644 index 61b95b3..0000000 --- a/netconfsimulator/netconf/yang_loader.log +++ /dev/null @@ -1 +0,0 @@ -INFO:werkzeug: * Running on http://0.0.0.0:5002/ (Press CTRL+C to quit) diff --git a/netconfsimulator/pom.xml b/netconfsimulator/pom.xml index 5896378..b000f1c 100644 --- a/netconfsimulator/pom.xml +++ b/netconfsimulator/pom.xml @@ -51,8 +51,10 @@ <netopeer-saver-source-dir>${project.basedir}/netopeer-change-saver-native</netopeer-saver-source-dir> <netopeer-saver-build-dir>${project.build.directory}/cmake</netopeer-saver-build-dir> <netopeer-saver-executable-dir>${netopeer-saver-build-dir}/bin</netopeer-saver-executable-dir> - <skipITs>true</skipITs> <proxy>""</proxy> + <skip-integration-tests>true</skip-integration-tests> + <skip-unit-tests>false</skip-unit-tests> + <project.build.integrationTestSourceDirectory>${project.basedir}/src/it/java</project.build.integrationTestSourceDirectory> </properties> <dependencies> @@ -210,15 +212,8 @@ </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> - <version>2.19</version> - <dependencies> - <dependency> - <groupId>org.junit.platform</groupId> - <artifactId>junit-platform-surefire-provider</artifactId> - <version>1.1.1</version> - </dependency> - </dependencies> <configuration> + <skipTests>${skip-unit-tests}</skipTests> <detail>true</detail> <printSummary>true</printSummary> <useSystemClassLoader>false</useSystemClassLoader> @@ -227,23 +222,63 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> - <version>2.19.1</version> <configuration> - <skipITs>${skipITs}</skipITs> + <testSourceDirectory>${project.build.integrationTestSourceDirectory}</testSourceDirectory> + <skipITs>${skip-integration-tests}</skipITs> </configuration> - <executions> - <execution> - <goals> - <goal>integration-test</goal> - <goal>verify</goal> - </goals> - </execution> - </executions> </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>3.1.0</version> + <executions> + <execution> + <id>add-integration-test-source-as-test-sources</id> + <phase>generate-test-sources</phase> + <goals> + <goal>add-test-source</goal> + </goals> + <configuration> + <sources> + <source>${project.build.integrationTestSourceDirectory}</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <executions> + <execution> + <id>prepare-agent</id> + <goals> + <goal>prepare-agent</goal> + </goals> + </execution> + <execution> + <id>report</id> + <goals> + <goal>report</goal> + </goals> + <configuration> + <dataFile>${project.build.directory}/code-coverage/jacoco.exec</dataFile> + <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> <profiles> <profile> + <id>integration</id> + <properties> + <skip-integration-tests>false</skip-integration-tests> + <skip-unit-tests>true</skip-unit-tests> + </properties> + </profile> + <profile> <id>docker</id> <activation> <activeByDefault>false</activeByDefault> @@ -297,6 +332,9 @@ <build> <contextDir>${project.basedir}</contextDir> <dockerFile>${project.basedir}/Dockerfile_netopeer</dockerFile> + <tags> + <tag>${project.version}-STAGE-${maven.build.timestamp}Z</tag> + </tags> <args> <PROXY>${proxy}</PROXY> </args> diff --git a/netconfsimulator/src/test/java/integration/NetconfFunctionsIT.java b/netconfsimulator/src/it/java/integration/NetconfFunctionsIT.java index 95ef586..5d1a25a 100644 --- a/netconfsimulator/src/test/java/integration/NetconfFunctionsIT.java +++ b/netconfsimulator/src/it/java/integration/NetconfFunctionsIT.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -152,9 +152,9 @@ public class NetconfFunctionsIT { Set<String> configChangeContent = kafkaMessages.stream().map(KafkaMessage::getConfiguration) .collect(Collectors.toSet()); assertThat(configChangeContent) - .anyMatch(el -> el.contains("new value: /pnf-simulator:config/itemValue1 = 100")); + .anyMatch(el -> el.contains("\"new\": {\"path\": \"/pnf-simulator:config/itemValue1\", \"value\": \"100\"}")); assertThat(configChangeContent) - .anyMatch(el -> el.contains("new value: /pnf-simulator:config/itemValue2 = 200")); + .anyMatch(el -> el.contains("\"new\": {\"path\": \"/pnf-simulator:config/itemValue2\", \"value\": \"200\"}")); } } @@ -170,9 +170,9 @@ public class NetconfFunctionsIT { assertThat(kafkaMessages).hasSize(2); assertThat(kafkaMessages.get(0).getConfiguration()) - .contains("new value: /pnf-simulator:config/itemValue1 = 100"); + .contains("\"new\": {\"path\": \"/pnf-simulator:config/itemValue1\", \"value\": \"100\"}"); assertThat(kafkaMessages.get(1).getConfiguration()) - .contains("new value: /pnf-simulator:config/itemValue2 = 200"); + .contains("\"new\": {\"path\": \"/pnf-simulator:config/itemValue2\", \"value\": \"200\"}"); } } @@ -188,7 +188,8 @@ public class NetconfFunctionsIT { } } - @Test + // ToDo: fix this integration test + // https://jira.onap.org/browse/INT-1535 public void shouldGetLoadedModelByName() throws IOException { testShouldLoadNewYangModelAndReconfigure(); diff --git a/netconfsimulator/src/test/java/integration/NetconfSimulatorClient.java b/netconfsimulator/src/it/java/integration/NetconfSimulatorClient.java index 61f2ef1..61f2ef1 100644 --- a/netconfsimulator/src/test/java/integration/NetconfSimulatorClient.java +++ b/netconfsimulator/src/it/java/integration/NetconfSimulatorClient.java |