diff --git a/test/plugin/containers/jvm-container/docker/run.sh b/test/plugin/containers/jvm-container/docker/run.sh index b8f32fef9333767cfa735e63cf2a3f65b6ddec0a..de7e5fd50f6118379bc7a7b7775589a4069e000b 100644 --- a/test/plugin/containers/jvm-container/docker/run.sh +++ b/test/plugin/containers/jvm-container/docker/run.sh @@ -25,7 +25,6 @@ function exitOnError() { function exitAndClean() { [[ -f ${SCENARIO_HOME}/data/actualData.yaml ]] && rm -rf ${SCENARIO_HOME}/data/actualData.yaml [[ -d ${SCENARIO_HOME}/logs ]] && rm -rf ${SCENARIO_HOME}/logs - [[ -d ${SCENARIO_HOME}/package ]] && rm -rf ${SCENARIO_HOME}/package exit $1 } @@ -85,9 +84,8 @@ curl -s http://localhost:12800/receiveData > ${SCENARIO_HOME}/data/actualData.ya echo "To validate" java -jar \ - -Dv2=true \ -Xmx256m -Xms256m \ - -DtestDate="`date +%Y-%m-%d-%H-%M`" \ + -DcaseName="${SCENARIO_NAME}-${SCENARIO_VERSION}" \ -DtestCasePath=${SCENARIO_HOME}/data/ \ ${TOOLS_HOME}/skywalking-validator-tools.jar 1>/dev/null status=$? diff --git a/test/plugin/containers/tomcat-container/docker/run.sh b/test/plugin/containers/tomcat-container/docker/run.sh index b1b82e29597c2cd916f40843babae97a68638431..f4d8b452f996e3f42ff441b424ea5aa53208328d 100644 --- a/test/plugin/containers/tomcat-container/docker/run.sh +++ b/test/plugin/containers/tomcat-container/docker/run.sh @@ -72,17 +72,16 @@ curl -s http://localhost:12800/receiveData > ${SCENARIO_HOME}/data/actualData.ya echo "To validate" java -jar \ - -Dv2=true \ - -Xmx256m -Xms256m \ - -DtestDate="`date +%Y-%m-%d-%H-%M`" \ - -DtestCasePath=${SCENARIO_HOME}/data/ \ - ${TOOLS_HOME}/skywalking-validator-tools.jar 1>/dev/null + -Xmx256m -Xms256m \ + -DcaseName="${SCENARIO_NAME}-${SCENARIO_VERSION}" \ + -DtestCasePath=${SCENARIO_HOME}/data/ \ + ${TOOLS_HOME}/skywalking-validator-tools.jar 1>/dev/null status=$? if [[ $status -eq 0 ]]; then - echo "Scenario[${SCENARIO_NAME}-${SCENARIO_VERSION}] passed!" >&2 + echo "Scenario[${SCENARIO_NAME}-${SCENARIO_VERSION}] passed!" >&2 else - cat ${SCENARIO_HOME}/data/actualData.yaml >&2 - exitOnError "Scenario[${SCENARIO_NAME}-${SCENARIO_VERSION}] failed!" + cat ${SCENARIO_HOME}/data/actualData.yaml >&2 + exitOnError "Scenario[${SCENARIO_NAME}-${SCENARIO_VERSION}] failed!" fi exitAndClean $status diff --git a/test/plugin/mock-collector/docker/Dockerfile b/test/plugin/mock-collector/docker/Dockerfile deleted file mode 100644 index 27952b968b8875deccecf3de6c7b192c0d66bbc8..0000000000000000000000000000000000000000 --- a/test/plugin/mock-collector/docker/Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# See the License for the specific language governing permissions and -# limitations under the License. - -FROM openjdk:8-jdk - -ENV GRPC_BIND_HOST=127.0.0.1 \ - GRPC_BIND_PORT=19876 - -ADD skywalking-mock-collector.tar.gz /usr/local -ADD config.properties /usr/local/skywalking-mock-collector/config/config.properties -EXPOSE 12800 -EXPOSE 5005 - -ADD docker-entrypoint.sh / -RUN chmod +x /docker-entrypoint.sh -ENTRYPOINT ["/docker-entrypoint.sh"] -CMD ["/usr/local/skywalking-mock-collector/bin/collector-startup.sh"] diff --git a/test/plugin/mock-collector/docker/config.properties b/test/plugin/mock-collector/docker/config.properties deleted file mode 100644 index 360086e0747d12cddc22863b87b3d9f418c09788..0000000000000000000000000000000000000000 --- a/test/plugin/mock-collector/docker/config.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# See the License for the specific language governing permissions and -# limitations under the License. - -grpc_bind_host={GRPC_BIND_HOST} -grpc_bind_port={GRPC_BIND_PORT} diff --git a/test/plugin/mock-collector/docker/docker-entrypoint.sh b/test/plugin/mock-collector/docker/docker-entrypoint.sh deleted file mode 100644 index f5d390abcd29ae7e5574f40cd2d56b56ac23adc2..0000000000000000000000000000000000000000 --- a/test/plugin/mock-collector/docker/docker-entrypoint.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash - -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# See the License for the specific language governing permissions and -# limitations under the License. - -echo "replace GRPC_BIND_HOST with $GRPC_BIND_HOST" -eval sed -i -e 's/\{GRPC_BIND_HOST\}/$GRPC_BIND_HOST/' /usr/local/skywalking-mock-collector/config/config.properties - -echo "replace GRPC_BIND_PORT with $GRPC_BIND_PORT" -eval sed -i -e 's/\{GRPC_BIND_PORT\}/$GRPC_BIND_PORT/' /usr/local/skywalking-mock-collector/config/config.properties - -exec "$@" diff --git a/test/plugin/mock-collector/pom.xml b/test/plugin/mock-collector/pom.xml index baf712a7d656ad453691080e1a8f7a52fd4aa0d9..d2e5f9619c48e135d2ad92a36a06266adffc4574 100644 --- a/test/plugin/mock-collector/pom.xml +++ b/test/plugin/mock-collector/pom.xml @@ -165,26 +165,6 @@ - - com.spotify - docker-maven-plugin - 0.4.13 - - true - ${docker.image.name} - - ${docker.image.version} - - ${project.basedir}/docker - - - / - ${project.basedir}/../dist - ${build.finalName}.tar.gz - - - - org.apache.maven.plugins maven-jar-plugin diff --git a/test/plugin/runner-helper/src/main/resources/docker-compose.template b/test/plugin/runner-helper/src/main/resources/docker-compose.template index 144fdf29ffdbdd7a5c5b8d6b15ffbfea34fd552f..d1f53fb1cf5b90af8b64ee98fbd0fddd2bc88595 100644 --- a/test/plugin/runner-helper/src/main/resources/docker-compose.template +++ b/test/plugin/runner-helper/src/main/resources/docker-compose.template @@ -84,7 +84,7 @@ services: <#if service.healthcheck??> healthcheck: <#list service.healthcheck as item> - - ${item} + ${item} \ No newline at end of file diff --git a/test/plugin/runner-helper/src/test/resources/configuration-test.yml b/test/plugin/runner-helper/src/test/resources/configuration-test.yml index d82c15c4c9a3fbd3ac63c3c9af43bf51dc8567ce..7b7e77c8c7cf3d665dcda8d1c629c9ed17a0a8d7 100644 --- a/test/plugin/runner-helper/src/test/resources/configuration-test.yml +++ b/test/plugin/runner-helper/src/test/resources/configuration-test.yml @@ -30,4 +30,9 @@ dependencies: - docker-entrypoint.sh - solr-precreate - mycore - + healthcheck: + - 'test: ["CMD", "curl", "-f", "http://localhost"]' + - 'interval: 1m30s' + - 'timeout: 10s' + - 'retries: 3' + - 'start_period: 40s' diff --git a/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/ConfigHelper.java b/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/ConfigHelper.java index 45dbf5ac65b04ebcaa61f9fb83ce1daa919b6dc4..fbe642513e16928d7cf1eed18f48013b39fb826a 100644 --- a/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/ConfigHelper.java +++ b/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/ConfigHelper.java @@ -17,76 +17,16 @@ package org.apache.skywalking.plugin.test.agent.tool; -import java.io.File; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - public class ConfigHelper { - private static Logger logger = LogManager.getLogger(ConfigHelper.class); private ConfigHelper() { } - public static String testDate() { - return System.getProperty("testDate"); - } - - public static String testCases() { - String testCasesInput = System.getProperty("testCases", ""); - if (testCasesInput.length() > 0) { - return testCasesInput; - } - String testCasePath = System.getProperty("testCasePath", ""); - - if (testCasePath.length() == 0) { - logger.warn("test case dir is empty"); - return ""; - } - - File testCaseDir = new File(testCasePath); - if (!testCaseDir.exists() || !testCaseDir.isDirectory()) { - logger.warn("test case dir is not exists or is not directory"); - return ""; - } - - StringBuilder testCases = new StringBuilder(); - File[] testCasesDir = testCaseDir.listFiles(); - for (File file : testCasesDir) { - testCases.append(file.getName() + ","); - } - - return testCases.toString(); + public static String caseName() { + return System.getProperty("caseName", ""); } public static String testCaseBaseDir() { return System.getProperty("testCasePath", ""); } - - public static boolean isV2() { - return Boolean.getBoolean("v2"); - } - - public static String reportFilePath() { - return System.getProperty("reportFilePath"); - } - - public static String agentBranch() { - return System.getProperty("agentBranch"); - } - - public static String agentCommit() { - return System.getProperty("agentCommitId"); - } - - public static String casesBranch() { - return System.getProperty("casesBranch", "").replace("/", "-"); - } - - public static String caseCommitId() { - return System.getProperty("casesCommitId", ""); - } - - public static String committer() { - return System.getProperty("committer", ""); - } } diff --git a/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/Main.java b/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/Main.java index d2db9fbc5612b38eaa1423d5432dac5aa57bc79e..96db5f6615b16e75b1899bf1bfc674016245bf07 100644 --- a/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/Main.java +++ b/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/Main.java @@ -22,45 +22,24 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.skywalking.plugin.test.agent.tool.validator.assertor.DataAssert; import org.apache.skywalking.plugin.test.agent.tool.validator.entity.Data; -import org.apache.skywalking.plugin.test.agent.tool.report.entity.Report; -import org.apache.skywalking.plugin.test.agent.tool.report.entity.TestCase; -import org.apache.skywalking.plugin.test.agent.tool.report.entity.TestCaseDesc; import org.apache.skywalking.plugin.test.agent.tool.validator.exception.AssertFailedException; public class Main { private static Logger logger = LogManager.getLogger(Main.class); public static void main(String[] args) { - Report report = new Report(); - String testCasePath = ConfigHelper.testCaseBaseDir(); - - boolean success = false; - if (ConfigHelper.isV2()) { - success |= verify(new File(testCasePath), TestCaseDesc.ParserV2.parse(), report).isSuccess(); - } else { - String[] testCases = ConfigHelper.testCases().split(","); - - for (String aCase : testCases) { - File casePath = new File(testCasePath, aCase); - File descFile = new File(casePath, "testcase.desc"); - success |= verify(casePath, TestCaseDesc.Parser.parse(descFile), report).isSuccess(); - } - } - - if (!ConfigHelper.isV2()) { - try { - report.generateReport(ConfigHelper.reportFilePath()); - } catch (Exception e) { - logger.error("Failed to generate report file", e); - } - } - System.exit(success ? 0 : 1); + System.exit(verify() ? 0 : 1); } - static TestCase verify(File casePath, TestCaseDesc testCaseDesc, Report report) { - TestCase testCase = new TestCase(testCaseDesc.getTestComponents()); + static boolean verify() { + File casePath = new File(ConfigHelper.testCaseBaseDir()); try { - logger.info("start to assert data of test case[{}]", testCase.getCaseName()); + if (!casePath.exists()) { + logger.error("test case dir is not exists or is not directory"); + return false; + } + + logger.info("start to assert data of test case[{}]", ConfigHelper.caseName()); File actualData = new File(casePath, "actualData.yaml"); File expectedData = new File(casePath, "expectedData.yaml"); @@ -68,18 +47,20 @@ public class Main { try { DataAssert.assertEquals(Data.Loader.loadData("expectedData.yaml", expectedData), Data.Loader.loadData("actualData.yaml", actualData)); - testCase.testedSuccessfully(); + return true; } catch (AssertFailedException e) { logger.error("\nassert failed.\n{}\n", e.getCauseMessage()); } } else { - logger.error("assert failed. because actual data {} and expected data {}", actualData.exists() ? "founded" : "not founded", actualData.exists() ? "founded" : "not founded"); + logger.error("assert failed. because actual data {} and expected data {}", + actualData.exists() ? "founded" : "not founded", + expectedData.exists() ? "founded" : "not founded" + ); } } catch (Exception e) { - logger.error("assert test case {} failed.", testCase.getCaseName(), e); + logger.error("assert test case {} failed.", ConfigHelper.caseName(), e); } - report.addTestCase(testCaseDesc.getProjectName(), testCaseDesc.getTestFramework(), testCase); - return testCase; + return false; } } diff --git a/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/report/entity/CaseVersionCategory.java b/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/report/entity/CaseVersionCategory.java deleted file mode 100644 index 594fa1269583334332448cf05821d9faa20c390e..0000000000000000000000000000000000000000 --- a/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/report/entity/CaseVersionCategory.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.skywalking.plugin.test.agent.tool.report.entity; - -import java.util.ArrayList; -import java.util.List; - -public class CaseVersionCategory { - private String name; - private List testCases; - - public CaseVersionCategory(String versionName) { - this.name = versionName; - testCases = new ArrayList<>(); - } - - public void addTestCases(TestCase testCase) { - this.testCases.add(testCase); - } - - public String getName() { - return name; - } - - public List getTestCases() { - return testCases; - } -} diff --git a/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/report/entity/FrameworkCases.java b/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/report/entity/FrameworkCases.java deleted file mode 100644 index 1de4cb2f12d4acf90a22174a3d390174b0cd68ad..0000000000000000000000000000000000000000 --- a/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/report/entity/FrameworkCases.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.skywalking.plugin.test.agent.tool.report.entity; - -import java.util.ArrayList; -import java.util.List; - -public class FrameworkCases { - private String testFramework; - private int successCaseCount; - private int totalCaseCount; - private List caseByVersionCategories; - - public FrameworkCases(String testFramework) { - this.testFramework = testFramework; - this.caseByVersionCategories = new ArrayList<>(); - } - - public void addTestCase(String versionCategory, TestCase aCase) { - CaseVersionCategory caseVersionCategory = findCategoryForProject(versionCategory); - if (caseVersionCategory == null) { - caseVersionCategory = new CaseVersionCategory(versionCategory); - this.caseByVersionCategories.add(caseVersionCategory); - } - - caseVersionCategory.addTestCases(aCase); - - if (aCase.isSuccessfully()) { - successCaseCount++; - } - totalCaseCount++; - } - - private CaseVersionCategory findCategoryForProject(String projectName) { - for (CaseVersionCategory project : caseByVersionCategories) { - if (project.getName().equals(projectName)) { - return project; - } - } - - return null; - } - - public String getTestFramework() { - return testFramework; - } - - public List getCaseByVersionCategories() { - return caseByVersionCategories; - } - - public int getSuccessCaseCount() { - return successCaseCount; - } - - public int getTotalCaseCount() { - return totalCaseCount; - } -} diff --git a/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/report/entity/Report.java b/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/report/entity/Report.java deleted file mode 100644 index 738adfe675e1843454b12cbf0624d6d453a9bdad..0000000000000000000000000000000000000000 --- a/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/report/entity/Report.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.skywalking.plugin.test.agent.tool.report.entity; - -import freemarker.template.Configuration; -import freemarker.template.Template; -import freemarker.template.TemplateException; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.StringWriter; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.apache.skywalking.plugin.test.agent.tool.ConfigHelper; - -public class Report { - private static Logger logger = LogManager.getLogger(Report.class); - private final String testDate; - private final String testBranch; - private final String commitId; - private final String caseBranch; - private final String caseCommit; - private final String committer; - private int successCaseCount; - private int totalCaseCount; - private List frameworkCases; - - public Report() { - this.testDate = formatTestDate(ConfigHelper.testDate()); - this.testBranch = ConfigHelper.agentBranch(); - this.commitId = ConfigHelper.agentCommit(); - this.caseBranch = ConfigHelper.casesBranch(); - this.caseCommit = ConfigHelper.caseCommitId(); - this.committer = ConfigHelper.committer(); - this.frameworkCases = new ArrayList<>(); - } - - public String getTestDate() { - return testDate; - } - - public String getTestBranch() { - return testBranch; - } - - public String getCommitId() { - return commitId; - } - - public List getFrameworkCases() { - return frameworkCases; - } - - private FrameworkCases findCasesByFrameworkName(String testFramework) { - for (FrameworkCases ascenario : frameworkCases) { - if (ascenario.getTestFramework().equalsIgnoreCase(testFramework)) { - return ascenario; - } - } - - return null; - } - - private String formatTestDate(String date) { - try { - Date testDate = new SimpleDateFormat("yyyy-MM-dd-HH-mm").parse(date); - return new SimpleDateFormat("yyyy-MM-dd HH:mm").format(testDate); - } catch (ParseException e) { - logger.error("Failed to format date[{}].", date, e); - } - return date; - } - - public void generateReport(String path) throws IOException, TemplateException, ParseException { - File reportFile = generateReportFile(path); - - Configuration cfg = new Configuration(Configuration.VERSION_2_3_23); - cfg.setClassForTemplateLoading(this.getClass(), "/template"); - cfg.setDefaultEncoding("UTF-8"); - Template template = cfg.getTemplate("main-report.md.ftl"); - StringWriter stringWriter = new StringWriter(); - Map resultMap = new HashMap<>(); - resultMap.put("testReport", this); - template.process(resultMap, stringWriter); - FileWriter fileOutputStream = new FileWriter(reportFile, false); - fileOutputStream.write(stringWriter.getBuffer().toString()); - stringWriter.close(); - fileOutputStream.close(); - } - - /** - * File Path Year - Month - apache - testReport-2019-10-10-10-11-11.md - testReport-2019-10-10-10-11-12.md - - * ascrutae ... - * - * @return - */ - private File generateReportFile(String basePath) throws ParseException, IOException { - Calendar calendar = Calendar.getInstance(); - calendar.setTime(new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(testDate)); - File testReportDir = new File(new File(new File(basePath, calendar.get(Calendar.YEAR) + ""), (calendar.get(Calendar.MONTH) + 1) + ""), ConfigHelper.committer()); - if (!testReportDir.exists()) { - testReportDir.mkdirs(); - } - String fileName = "testReport-" + ConfigHelper.casesBranch() + "-" + ConfigHelper.testDate() + ".md"; - File testReportFile = new File(testReportDir, fileName); - if (!testReportFile.exists()) { - testReportFile.createNewFile(); - } - return testReportFile; - } - - public void addTestCase(String projectName, String framework, TestCase aCase) { - FrameworkCases frameworkCases = findCasesByFrameworkName(framework); - if (frameworkCases == null) { - frameworkCases = new FrameworkCases(framework); - this.frameworkCases.add(frameworkCases); - } - - frameworkCases.addTestCase(projectName, aCase); - - if (aCase.isSuccessfully()) { - successCaseCount++; - } - totalCaseCount++; - } - - public int getSuccessCaseCount() { - return successCaseCount; - } - - public int getTotalCaseCount() { - return totalCaseCount; - } - - public String getCaseBranch() { - return caseBranch; - } - - public String getCaseCommit() { - return caseCommit; - } -} diff --git a/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/report/entity/TestCase.java b/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/report/entity/TestCase.java deleted file mode 100644 index cc51b7a70d31099a8aa701199054471161de7139..0000000000000000000000000000000000000000 --- a/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/report/entity/TestCase.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.skywalking.plugin.test.agent.tool.report.entity; - -public class TestCase { - private String caseName; - private boolean success; - - public TestCase(String testComponents) { - this.caseName = testComponents; - } - - public String getCaseName() { - return caseName; - } - - public void testedSuccessfully() { - this.success = true; - } - - public boolean isSuccessfully() { - return success; - } - - public boolean isSuccess() { - return success; - } -} diff --git a/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/report/entity/TestCaseDesc.java b/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/report/entity/TestCaseDesc.java deleted file mode 100644 index e7356514489289b726e2acd2e9116d68bafb21c6..0000000000000000000000000000000000000000 --- a/test/plugin/validator/src/main/java/org/apache/skywalking/plugin/test/agent/tool/report/entity/TestCaseDesc.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.skywalking.plugin.test.agent.tool.report.entity; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.util.Properties; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -public class TestCaseDesc { - private static Logger logger = LogManager.getLogger(TestCaseDesc.class); - private String testFramework; - private String testComponents; - private String projectName; - - private TestCaseDesc() { - } - - public static class Parser { - public static TestCaseDesc parse(File caseDescFile) { - TestCaseDesc testCase = new TestCaseDesc(); - Properties properties = new Properties(); - if (caseDescFile.exists()) { - try { - properties.load(new FileInputStream(caseDescFile)); - } catch (IOException e) { - logger.error("Failed to parse case desc file[{}]", caseDescFile.getAbsoluteFile()); - return testCase; - } - } - - testCase.projectName = properties.getProperty("case.projectName", null); - testCase.testFramework = properties.getProperty("case.testFramework", null); - testCase.testComponents = properties.getProperty("case.testComponents", null); - logger.info("load case desc: projectName[{}] testFramework[{}], testComponents[{}], cooperativeFrameworks[{}]", - testCase.projectName, - testCase.testFramework, - testCase.testComponents); - return testCase; - } - } - - public static class ParserV2 { - public static TestCaseDesc parse() { - TestCaseDesc testCase = new TestCaseDesc(); - testCase.projectName = System.getProperty("case.projectName", null); - testCase.testFramework = System.getProperty("case.testFramework", null); - testCase.testComponents = System.getProperty("case.testComponents", null); - logger.info("load case desc: projectName[{}] testFramework[{}], testComponents[{}], cooperativeFrameworks[{}]", - testCase.projectName, - testCase.testFramework, - testCase.testComponents); - return testCase; - } - } - - public String getTestFramework() { - return testFramework; - } - - public String getTestComponents() { - return testComponents; - } - - public String getProjectName() { - return projectName; - } -} diff --git a/test/plugin/validator/src/main/resources/template/main-report.md.ftl b/test/plugin/validator/src/main/resources/template/main-report.md.ftl deleted file mode 100644 index 149e1cc294e9bd36d123e00671c3c5aa98a142ff..0000000000000000000000000000000000000000 --- a/test/plugin/validator/src/main/resources/template/main-report.md.ftl +++ /dev/null @@ -1,43 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You 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. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Test Report - ${testReport.testDate} - -- tests : **${testReport.successCaseCount} passed**. **${testReport.totalCaseCount - testReport.successCaseCount} failed** -- branch name : **[${testReport.testBranch}](https://github.com/apache/incubator-skywalking/tree/${testReport.testBranch})** -- commit id : **[${testReport.commitId}](https://github.com/apache/incubator-skywalking/commit/${testReport.commitId})** -- cases branch: **[${testReport.caseBranch}](https://github.com/SkywalkingTest/skywalking-autotest-scenarios/tree/${testReport.caseBranch})** -- cases commit id: **[${testReport.caseCommit}](https://github.com/SkywalkingTest/skywalking-autotest-scenarios/commit/${testReport.caseCommit})** - -## Cases List - -| Case description | Status | Cases| -|:-----|:-----:|:-----:| -<#list testReport.frameworkCases as frameworkCases> -|${frameworkCases.testFramework}| **${frameworkCases.successCaseCount} passed. ${frameworkCases.totalCaseCount - frameworkCases.successCaseCount} failed**| [click me](#${frameworkCases.testFramework?lower_case}) | - - -<#list testReport.frameworkCases as frameworkCases> -## ${frameworkCases.testFramework} - -### <#list frameworkCases.caseByVersionCategories as versionCategory> -| Version | Passed | Failed| -|:------------- |:-------:|:-----:| -<#list versionCategory.testCases as item> -| ${item.caseName} | <#if item.success>:heavy_check_mark:|<#if !item.success>:heavy_check_mark:| - - - -