summaryrefslogtreecommitdiffstats
path: root/integration-tests
diff options
context:
space:
mode:
authorPiotr Marcinkiewicz <piotr.marcinkiewicz@nokia.com>2021-05-26 09:45:45 +0200
committerVasyl Razinkov <vasyl.razinkov@est.tech>2021-06-15 16:30:42 +0000
commitc8bc4d451d6a517b3eeff53c5bf0a49f3840b07c (patch)
tree14e3757b946c275021b09176a9c24ac100e73485 /integration-tests
parentddf9aaefc753b492fb72144d597a27df8080a4ab (diff)
Add test cases for Helm validation
Issue-ID: SDC-3185 Signed-off-by: Piotr Marcinkiewicz <piotr.marcinkiewicz@nokia.com> Signed-off-by: Tomasz Wrobel <tomasz.wrobel@nokia.com> Signed-off-by: Joanna Jeremicz <joanna.jeremicz@nokia.com> Change-Id: Ic68907aa385e5a735d0948ca2177e6aac12b2e7b
Diffstat (limited to 'integration-tests')
-rw-r--r--integration-tests/environments/integration-test.json7
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/data/providers/OnboardingDataProviders.java24
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/datatypes/enums/XnfTypeEnum.java1
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/sanity/Onboard.java28
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/utils/general/FileHandling.java6
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/utils/general/OnboardingUtils.java13
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/utils/general/VendorSoftwareProductRestUtils.java10
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/dataProvider/OnbordingDataProviders.java35
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/OnboardingFlowsUi.java56
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/VspValidationPage.java69
-rw-r--r--integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/FileHandling.java14
-rw-r--r--integration-tests/src/test/resources/Files/CNFs/helm-package-valid.zipbin1151 -> 2423 bytes
-rw-r--r--integration-tests/src/test/resources/Files/CNFs/helm-package-valid_expect1
-rw-r--r--integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/one_error_two_files.zipbin0 -> 2028 bytes
-rw-r--r--integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/one_error_two_files_expect1
-rw-r--r--integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/package_invalid_nil_pointer_render_error.zipbin0 -> 1197 bytes
-rw-r--r--integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/package_invalid_nil_pointer_render_error_expect1
-rw-r--r--integration-tests/src/test/resources/Files/CNFs/helm_validator/package_valid.zipbin0 -> 1130 bytes
-rw-r--r--integration-tests/src/test/resources/Files/CNFs/helm_validator/valid_two_files.zipbin0 -> 2004 bytes
-rw-r--r--integration-tests/src/test/resources/Files/CNFs/helm_validator/with_warnings/one_warning_two_files.zipbin0 -> 2104 bytes
-rw-r--r--integration-tests/src/test/resources/Files/CNFs/helm_validator/with_warnings/one_warning_two_files_expect1
-rw-r--r--integration-tests/src/test/resources/ci/testSuites/backend/helmValidatorTests.xml6
-rw-r--r--integration-tests/src/test/resources/ci/testSuites/backend/onapApiSanity.xml7
-rw-r--r--integration-tests/src/test/resources/ci/testSuites/frontend/helmValidatorTests.xml7
24 files changed, 264 insertions, 23 deletions
diff --git a/integration-tests/environments/integration-test.json b/integration-tests/environments/integration-test.json
index e71e53b01d..3402113ed2 100644
--- a/integration-tests/environments/integration-test.json
+++ b/integration-tests/environments/integration-test.json
@@ -40,11 +40,12 @@
"vnfRepoHost": "10.0.14.1"
},
"HelmValidator": {
- "validator_enabled": false,
+ "validator_enabled": true,
"helm_version": "v3",
"deployable": true,
- "lintable": false,
- "strict_lintable": false
+ "lintable": true,
+ "strict_lintable": false,
+ "validator_url": "http://helm-validator:8080/validate"
}
},
"override_attributes": {
diff --git a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/data/providers/OnboardingDataProviders.java b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/data/providers/OnboardingDataProviders.java
index 314e37d2fc..16c9521ac6 100644
--- a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/data/providers/OnboardingDataProviders.java
+++ b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/data/providers/OnboardingDataProviders.java
@@ -22,6 +22,7 @@ package org.onap.sdc.backend.ci.tests.data.providers;
import static org.testng.Assert.fail;
+import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -82,7 +83,28 @@ public final class OnboardingDataProviders {
private static Object[][] invalidCnfList() {
final List<String> fileNamesFromFolder = OnboardingUtils.getInvalidXnfNamesFileList(XnfTypeEnum.CNF);
LOGGER.debug(String.format("There are %s package file(s) to test", fileNamesFromFolder.size()));
- return provideData(fileNamesFromFolder, FileHandling.getXnfRepositoryPath(XnfTypeEnum.CNF));
+ return provideData(fileNamesFromFolder, FileHandling.getXnfRepositoryPath(XnfTypeEnum.CNF) + File.separator + OnboardingUtils.INVALID_XNFS_SUBPATH);
+ }
+
+ @DataProvider(name = "CNF_Helm_Validator_List", parallel = true)
+ private static Object[][] cnfForHelmValidatorList() {
+ final List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.CNF_HELM);
+ LOGGER.debug(String.format("There are %s package file(s) to test", fileNamesFromFolder.size()));
+ return provideData(fileNamesFromFolder, FileHandling.getXnfRepositoryPath(XnfTypeEnum.CNF_HELM));
+ }
+
+ @DataProvider(name = "CNF_With_Warning_Helm_Validator_List", parallel = true)
+ private static Object[][] cnfWithWarningForHelmValidatorList() {
+ final List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesWithWarningsFileList(XnfTypeEnum.CNF_HELM);
+ LOGGER.debug(String.format("There are %s package file(s) to test", fileNamesFromFolder.size()));
+ return provideData(fileNamesFromFolder, FileHandling.getXnfRepositoryPath(XnfTypeEnum.CNF_HELM) + File.separator + OnboardingUtils.WITH_WARNINGS_XNFS_SUBPATH);
+ }
+
+ @DataProvider(name = "Invalid_CNF_Helm_Validator_List", parallel = true)
+ private static Object[][] invalidCnfForHelmValidatorList() {
+ final List<String> fileNamesFromFolder = OnboardingUtils.getInvalidXnfNamesFileList(XnfTypeEnum.CNF_HELM);
+ LOGGER.debug(String.format("There are %s package file(s) to test", fileNamesFromFolder.size()));
+ return provideData(fileNamesFromFolder, FileHandling.getXnfRepositoryPath(XnfTypeEnum.CNF_HELM) + File.separator + OnboardingUtils.INVALID_XNFS_SUBPATH);
}
@DataProvider(name = "Single_VNF", parallel = true)
diff --git a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/datatypes/enums/XnfTypeEnum.java b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/datatypes/enums/XnfTypeEnum.java
index 7d7ebcd278..152612a77f 100644
--- a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/datatypes/enums/XnfTypeEnum.java
+++ b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/datatypes/enums/XnfTypeEnum.java
@@ -28,6 +28,7 @@ import lombok.Getter;
public enum XnfTypeEnum {
CNF("CNF"),
+ CNF_HELM("CNF_HELM"),
ETSI("ETSI"),
PNF("PNF"),
VFC("VFC"),
diff --git a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/sanity/Onboard.java b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/sanity/Onboard.java
index d67390e304..a3323b98d3 100644
--- a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/sanity/Onboard.java
+++ b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/sanity/Onboard.java
@@ -8,9 +8,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.
@@ -53,11 +53,11 @@ public class Onboard extends ComponentBaseTest {
private String makeToscaValidationValue;
@Rule
public static final TestName name = new TestName();
-
+
@Parameters({ "makeDistribution" })
@BeforeMethod
public void beforeTestReadParams(@Optional("true") String makeDistributionReadValue) {
- makeDistributionValue = makeDistributionReadValue;
+ makeDistributionValue = makeDistributionReadValue;
logger.info("makeDistributionReadValue - > " + makeDistributionValue);
}
@@ -67,7 +67,7 @@ public class Onboard extends ComponentBaseTest {
makeToscaValidationValue = makeToscaValidationReadValue;
logger.info("makeToscaValidationReadValue - > " + makeToscaValidationValue);
}
-
+
@Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "VNF_List")
public void onboardVNFShotFlow(String filePath, String vnfFile) throws Exception {
@@ -93,6 +93,24 @@ public class Onboard extends ComponentBaseTest {
assertThrows(() -> runOnboardToDistributionFlow(filePath, cnfFile, ResourceTypeEnum.VF));
}
+ @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "CNF_Helm_Validator_List")
+ public void onboardCNFWithHelmValidatorFlow(String filePath, String cnfFile) throws Exception {
+ setLog(cnfFile);
+ runOnboardToDistributionFlow(filePath, cnfFile, ResourceTypeEnum.VF);
+ }
+
+ @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "CNF_With_Warning_Helm_Validator_List")
+ public void onboardCNFWithHelmValidatorFlowWithWarning(String filePath, String cnfFile) throws Exception {
+ setLog(cnfFile);
+ runOnboardToDistributionFlow(filePath, cnfFile, ResourceTypeEnum.VF);
+ }
+
+ @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Invalid_CNF_Helm_Validator_List")
+ public void onboardCNFWithHelmValidatorShouldFailTest(String filePath, String cnfFile) {
+ setLog(cnfFile);
+ assertThrows(() -> runOnboardToDistributionFlow(filePath, cnfFile, ResourceTypeEnum.VF));
+ }
+
private void runOnboardToDistributionFlow(String packageFilePath, String packageFileName, ResourceTypeEnum resourceTypeEnum) throws Exception {
ExtentTestActions.log(Status.INFO, String.format("Going to onboard the %s %s", resourceTypeEnum.getValue(), packageFileName));
User user = ElementFactory.getDefaultUser(UserRoleEnum.DESIGNER);
diff --git a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/utils/general/FileHandling.java b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/utils/general/FileHandling.java
index 766c88734d..dcb3ecb14b 100644
--- a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/utils/general/FileHandling.java
+++ b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/utils/general/FileHandling.java
@@ -3,6 +3,7 @@
* SDC
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2021 Nokia. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -135,6 +136,7 @@ public class FileHandling {
private static EnumMap<XnfTypeEnum, String> XNF_REPOSITORY_PATHS_MAP = new EnumMap<>(Map.of(
XnfTypeEnum.PNF, getPnfRepositoryPath(),
XnfTypeEnum.CNF, getCnfRepositoryPath(),
+ XnfTypeEnum.CNF_HELM, getCnfRepositoryForHelmValidatorPath(),
XnfTypeEnum.VNF, getVnfRepositoryPath(),
XnfTypeEnum.ETSI, getEtsiRepositoryPath(),
XnfTypeEnum.VFC, getVfcRepositoryPath()
@@ -152,6 +154,10 @@ public class FileHandling {
return getFilePath("CNFs");
}
+ private static String getCnfRepositoryForHelmValidatorPath() {
+ return getFilePath("CNFs/helm_validator");
+ }
+
private static String getEtsiRepositoryPath() { return getFilePath("ETSI"); }
private static String getVfcRepositoryPath() { return getFilePath("VFCs"); }
diff --git a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/utils/general/OnboardingUtils.java b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/utils/general/OnboardingUtils.java
index 22c314494f..6630345559 100644
--- a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/utils/general/OnboardingUtils.java
+++ b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/utils/general/OnboardingUtils.java
@@ -24,6 +24,7 @@ package org.onap.sdc.backend.ci.tests.utils.general;
import static org.onap.sdc.backend.ci.tests.utils.general.FileHandling.filterFileNamesListFromFolder;
import java.io.File;
+import java.nio.file.Paths;
import org.onap.sdc.backend.ci.tests.datatypes.enums.XnfTypeEnum;
import org.onap.sdc.backend.ci.tests.datatypes.http.HttpHeaderEnum;
import org.onap.sdc.backend.ci.tests.datatypes.http.HttpRequest;
@@ -109,7 +110,8 @@ public class OnboardingUtils {
"1-2017389vtsbc4vf-(VOIP)_v11.0.zip"
);
- private static final String INVALID_XNFS_SUBPATH = "invalid";
+ public static final String INVALID_XNFS_SUBPATH = "invalid";
+ public static final String WITH_WARNINGS_XNFS_SUBPATH = "with_warnings";
public static String handleFilename(String heatFileName) {
final String namePrefix = String.format("%sVF%s", ElementFactory.getResourcePrefix(), "Onboarded-");
@@ -205,6 +207,15 @@ public class OnboardingUtils {
}
/**
+ * @return
+ * The method returns names list of XNF packages with warnings from Files directory under sdc repository
+ */
+ public static List<String> getXnfNamesWithWarningsFileList(XnfTypeEnum xnfTypeEnum) {
+ String filepath = FileHandling.getXnfRepositoryPath(xnfTypeEnum) + File.separator + WITH_WARNINGS_XNFS_SUBPATH;
+ return FileHandling.getZipFileNamesFromFolder(filepath);
+ }
+
+ /**
* @param vnfNamesFileList
* @return divide List according to day of month, if day of month is even as get first half part of the List, else - second
*/
diff --git a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/utils/general/VendorSoftwareProductRestUtils.java b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/utils/general/VendorSoftwareProductRestUtils.java
index 96d6416236..1eea8f320d 100644
--- a/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/utils/general/VendorSoftwareProductRestUtils.java
+++ b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/utils/general/VendorSoftwareProductRestUtils.java
@@ -23,6 +23,8 @@ package org.onap.sdc.backend.ci.tests.utils.general;
import com.aventstack.extentreports.Status;
import com.clearspring.analytics.util.Pair;
import com.google.gson.Gson;
+import java.nio.file.Files;
+import java.nio.file.Path;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
@@ -58,6 +60,7 @@ import java.util.Iterator;
import java.util.Map;
import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
public class VendorSoftwareProductRestUtils {
@@ -129,6 +132,13 @@ public class VendorSoftwareProductRestUtils {
RestResponse validateUpload = validateUpload(createNewVspPair.right, user);
assertEquals("did not succeed to validate upload process, reason: " + validateUpload.getResponse(), 200, validateUpload.getErrorCode().intValue());
+ Path expectPath = FileSystems.getDefault().getPath(filepath + File.separator + heatFileName.substring(0, heatFileName.indexOf('.')) + "_expect");
+
+ if(Files.exists(expectPath)) {
+ String content = Files.readString(expectPath);
+ assertTrue(validateUpload.getResponse().contains(content.trim().replaceAll("[\n\r]", "")));
+ }
+
return createNewVspPair.right;
}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/dataProvider/OnbordingDataProviders.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/dataProvider/OnbordingDataProviders.java
index 3a9fd4d9a3..41b247c338 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/dataProvider/OnbordingDataProviders.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/dataProvider/OnbordingDataProviders.java
@@ -24,6 +24,8 @@ package org.onap.sdc.frontend.ci.tests.dataProvider;
import org.onap.sdc.backend.ci.tests.datatypes.enums.XnfTypeEnum;
import org.onap.sdc.backend.ci.tests.utils.general.OnboardingUtils;
import org.onap.sdc.frontend.ci.tests.utilities.FileHandling;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
@@ -33,6 +35,7 @@ import java.util.Collections;
import java.util.List;
public class OnbordingDataProviders {
+ private static final Logger LOGGER = LoggerFactory.getLogger(OnbordingDataProviders.class);
private static final String VSP_VGW_CSAR = "vsp-vgw.csar";
private static final int NUMBER_OF_RANDOMLY_ONBOARD_VNF = 3;
@@ -44,34 +47,44 @@ public class OnbordingDataProviders {
int randomElementNumber = NUMBER_OF_RANDOMLY_ONBOARD_VNF; //how many VNFs to onboard randomly
List<String> fileNamesFromFolder = OnboardingUtils.getVnfNamesFileListExcludeToscaParserFailure();
List<String> newRandomFileNamesFromFolder = getRandomElements(randomElementNumber, fileNamesFromFolder);
- System.out.println(String.format("There are %s zip file(s) to test", newRandomFileNamesFromFolder.size()));
return provideData(newRandomFileNamesFromFolder, filepath);
}
@DataProvider(name = "VNF_List", parallel = true)
private static Object[][] VnfList() throws Exception {
-
List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.VNF);
-
- System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size()));
return provideData(fileNamesFromFolder, filepath);
}
@DataProvider(name = "CNF_List", parallel = true)
private static Object[][] cnfList() {
-
List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.CNF);
-
- System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size()));
return provideData(fileNamesFromFolder, FileHandling.getCnfRepositoryPath());
}
+ @DataProvider(name = "CNF_Helm_Validator_List", parallel = true)
+ private static Object[][] cnfForHelmValidatorList() {
+ List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.CNF_HELM);
+ return provideData(fileNamesFromFolder, FileHandling.getCnfForHelmValidatorRepositoryPath());
+ }
+
+ @DataProvider(name = "CNF_With_Warning_Helm_Validator_List", parallel = true)
+ private static Object[][] cnfWithWarningForHelmValidatorList() {
+ List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesWithWarningsFileList(XnfTypeEnum.CNF_HELM);
+ Object[][] objects = provideData(fileNamesFromFolder,
+ FileHandling.getCnfWithWarningForHelmValidatorRepositoryPath());
+ return objects;
+ }
+
+ @DataProvider(name = "Invalid_CNF_Helm_Validator_List", parallel = true)
+ private static Object[][] invalidCnfForHelmValidatorList() {
+ List<String> fileNamesFromFolder = OnboardingUtils.getInvalidXnfNamesFileList(XnfTypeEnum.CNF_HELM);
+ return provideData(fileNamesFromFolder, FileHandling.getInvalidCnfForHelmValidatorRepositoryPath());
+ }
+
@DataProvider(name = "Invalid_CNF_List", parallel = true)
private static Object[][] invalidCnfList() {
-
List<String> fileNamesFromFolder = OnboardingUtils.getInvalidXnfNamesFileList(XnfTypeEnum.CNF);
-
- System.out.println(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size()));
return provideData(fileNamesFromFolder, FileHandling.getCnfRepositoryPath());
}
@@ -106,7 +119,7 @@ public class OnbordingDataProviders {
// -----------------------methods-----------------------------------------
static Object[][] provideData(List<String> fileNamesFromFolder, String filepath) {
-
+ LOGGER.info(String.format("There are %s zip file(s) to test", fileNamesFromFolder.size()));
Object[][] arObject = new Object[fileNamesFromFolder.size()][];
int index = 0;
for (Object obj : fileNamesFromFolder) {
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/OnboardingFlowsUi.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/OnboardingFlowsUi.java
index 693302aca1..5d1b3b3a60 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/OnboardingFlowsUi.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/execute/sanity/OnboardingFlowsUi.java
@@ -473,6 +473,62 @@ public class OnboardingFlowsUi extends SetupCDTest {
runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, cnfFile);
}
+ @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "CNF_Helm_Validator_List")
+ public void onapOnboardVSPWithHelmValidationSuccessfulWithoutErrorsAndWarnings(String filePath, String cnfFile) throws Exception {
+
+ setLog(cnfFile);
+ String vspName = createNewVSP(filePath, cnfFile);
+ goToVspScreen(true, vspName);
+
+ boolean isVspAttachmentValidationPage = VspValidationPage.isVspAttachmentsValidationPage();
+ if (!isVspAttachmentValidationPage) {
+ VspValidationPage.navigateToVspAttachmentsValidationPage();
+ }
+
+ assertTrue("Submit button should be enabled for correct helm chart",
+ VspValidationPage.isSubmitButtonEnabled());
+ assertFalse("Attachment should not have any warnings for correct helm chart",
+ VspValidationPage.hasHelmAttachmentsAnyWarnings());
+ assertFalse("Attachment should not have any error for correct helm chart",
+ VspValidationPage.hasHelmAttachmentsAnyError());
+ }
+
+ @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "CNF_With_Warning_Helm_Validator_List")
+ public void onapOnboardVSPWithHelmValidationSuccessfulWithWarnings(String filePath, String cnfFile) throws Exception {
+ setLog(cnfFile);
+ String vspName = createNewVSP(filePath, cnfFile);
+ goToVspScreen(true, vspName);
+
+ boolean isVspAttachmentValidationPage = VspValidationPage.isVspAttachmentsValidationPage();
+ if (!isVspAttachmentValidationPage) {
+ VspValidationPage.navigateToVspAttachmentsValidationPage();
+ }
+
+ assertTrue("Submit button should be enabled for helm chart with warning",
+ VspValidationPage.isSubmitButtonEnabled());
+ assertTrue("Attachment should have warnings for helm chart with warning",
+ VspValidationPage.hasHelmAttachmentsAnyWarnings());
+ assertFalse("Attachment should not have error for helm chart with warning",
+ VspValidationPage.hasHelmAttachmentsAnyError());
+ }
+
+ @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "Invalid_CNF_Helm_Validator_List")
+ public void onapOnboardVSPWithHelmValidationUnsuccessfulWithErrors(String filePath, String cnfFile) throws Exception {
+ setLog(cnfFile);
+ String vspName = createNewVSP(filePath, cnfFile);
+ goToVspScreen(true, vspName);
+
+ boolean isVspAttachmentValidationPage = VspValidationPage.isVspAttachmentsValidationPage();
+ if (!isVspAttachmentValidationPage) {
+ VspValidationPage.navigateToVspAttachmentsValidationPage();
+ }
+
+ assertFalse("Submit button should be disabled for helm chart with error",
+ VspValidationPage.isSubmitButtonEnabled());
+ assertTrue("Attachment should have error for helm chart with error",
+ VspValidationPage.hasHelmAttachmentsAnyError());
+ }
+
@Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "Invalid_CNF_List")
public void onboardCNFTestShouldFailForInvalidHelmPackage(String filePath, String cnfFile) {
setLog(cnfFile);
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/VspValidationPage.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/VspValidationPage.java
index 6d980ceb64..4b34e6804f 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/VspValidationPage.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/pages/VspValidationPage.java
@@ -1,5 +1,6 @@
/**
* Copyright (c) 2019 Vodafone Group
+ * Copyright (C) 2021 Nokia. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +23,7 @@ import org.onap.sdc.frontend.ci.tests.datatypes.DataTestIdEnum;
import org.onap.sdc.frontend.ci.tests.execute.setup.SetupCDTest;
import org.onap.sdc.frontend.ci.tests.utilities.GeneralUIUtils;
import org.openqa.selenium.By;
+import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
@@ -30,6 +32,17 @@ import java.util.List;
public class VspValidationPage extends GeneralPageElements {
+ private static final String ATTACHMENT_NAME_TEST_ID = ".//*[@data-test-id='validation-tree-node-name']";
+ private static final String VALIDATION_ERROR_COUNT = ".//*[@data-test-id='validation-error-count']";
+ private static final String VALIDATION_WARNING_COUNT = ".//*[@data-test-id='validation-warning-count']";
+ private static final String SOFTWARE_PRODUCT_ATTACHMENTS = "navbar-group-item-SOFTWARE_PRODUCT_ATTACHMENTS";
+ private static final String ATTACHMENTS_TAB_VALIDATION = "attachments-tab-validation";
+ private static final String SDC_TAB_ACTIVE_CLASS_NAME = "sdc-tab-active";
+ private static final String ATTACHMENTS_NODE_ID = "validation-tree-node";
+ private static final String HELM_ATTACHMENT_EXTENSION = ".tgz";
+ private static final String SUBMIT_BUTTON_ID = "vc-submit-btn";
+ private static final int TWO_SECONDS_TIMEOUT = 2;
+
private VspValidationPage() {
super();
}
@@ -127,9 +140,63 @@ public class VspValidationPage extends GeneralPageElements {
GeneralUIUtils.ultimateWait();
}
+ public static boolean isSubmitButtonEnabled() {
+ return !GeneralUIUtils.isElementDisabled(SUBMIT_BUTTON_ID);
+ }
+
+ public static boolean hasHelmAttachmentsAnyWarnings() {
+ return GeneralUIUtils.getWebElementsListByTestID(ATTACHMENTS_NODE_ID)
+ .stream()
+ .filter(webElement -> hasAttachmentFileExtension(webElement, HELM_ATTACHMENT_EXTENSION))
+ .anyMatch(VspValidationPage::elementHasWarningCount);
+ }
+
+ public static boolean hasHelmAttachmentsAnyError() {
+ return GeneralUIUtils.getWebElementsListByTestID(ATTACHMENTS_NODE_ID)
+ .stream()
+ .filter(webElement -> hasAttachmentFileExtension(webElement, HELM_ATTACHMENT_EXTENSION))
+ .anyMatch(VspValidationPage::elementHasErrorCount);
+ }
+
+ public static boolean isVspAttachmentsValidationPage() {
+ WebElement webElementByTestID = GeneralUIUtils.getWebElementByTestID(
+ ATTACHMENTS_TAB_VALIDATION, TWO_SECONDS_TIMEOUT);
+ return webElementByTestID != null && webElementByTestID.getAttribute("class").contains(
+ SDC_TAB_ACTIVE_CLASS_NAME);
+ }
+
+ public static void navigateToVspAttachmentsValidationPage() {
+ GeneralUIUtils.clickOnElementByTestId(SOFTWARE_PRODUCT_ATTACHMENTS);
+ GeneralUIUtils.clickOnElementByTestId(ATTACHMENTS_TAB_VALIDATION);
+ }
+
+ private static boolean elementHasWarningCount(WebElement webElement) {
+ try {
+ webElement.findElement(By.xpath(VALIDATION_WARNING_COUNT));
+ return true;
+ } catch (NoSuchElementException ex) {
+ return false;
+ }
+ }
+
+ private static boolean elementHasErrorCount(WebElement webElement) {
+ try {
+ webElement.findElement(By.xpath(VALIDATION_ERROR_COUNT));
+ return true;
+ } catch (NoSuchElementException ex) {
+ return false;
+ }
+ }
+
+ private static boolean hasAttachmentFileExtension(WebElement webElement, String extension) {
+ return webElement
+ .findElement(By.xpath(ATTACHMENT_NAME_TEST_ID))
+ .getText()
+ .endsWith(extension);
+ }
+
private static List<WebElement> getChildElements(WebElement webElement) throws Exception {
return webElement.findElements(By.xpath(".//*"));
}
-
}
diff --git a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/FileHandling.java b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/FileHandling.java
index 04b203798b..9ec9911f38 100644
--- a/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/FileHandling.java
+++ b/integration-tests/src/test/java/org/onap/sdc/frontend/ci/tests/utilities/FileHandling.java
@@ -3,6 +3,7 @@
* SDC
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2021 Nokia. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -150,10 +151,23 @@ public class FileHandling {
public static String getVnfRepositoryPath() {
return getFilePath("VNFs");
}
+
public static String getCnfRepositoryPath() {
return getFilePath("CNFs");
}
+ public static String getCnfForHelmValidatorRepositoryPath() {
+ return getFilePath("CNFs/helm_validator");
+ }
+
+ public static String getCnfWithWarningForHelmValidatorRepositoryPath() {
+ return getFilePath("CNFs/helm_validator/with_warnings");
+ }
+
+ public static String getInvalidCnfForHelmValidatorRepositoryPath() {
+ return getFilePath("CNFs/helm_validator/invalid");
+ }
+
public static String getUpdateVSPVnfRepositoryPath() {
return getFilePath("UpdateVSP");
}
diff --git a/integration-tests/src/test/resources/Files/CNFs/helm-package-valid.zip b/integration-tests/src/test/resources/Files/CNFs/helm-package-valid.zip
index 349a9ee0b2..a28a7c2b59 100644
--- a/integration-tests/src/test/resources/Files/CNFs/helm-package-valid.zip
+++ b/integration-tests/src/test/resources/Files/CNFs/helm-package-valid.zip
Binary files differ
diff --git a/integration-tests/src/test/resources/Files/CNFs/helm-package-valid_expect b/integration-tests/src/test/resources/Files/CNFs/helm-package-valid_expect
new file mode 100644
index 0000000000..8923fa7865
--- /dev/null
+++ b/integration-tests/src/test/resources/Files/CNFs/helm-package-valid_expect
@@ -0,0 +1 @@
+"third.tgz":[{"level":"WARNING","message":"WARNING: [HELM VALIDATOR]: [WARNING] templates/: directory not found"}]
diff --git a/integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/one_error_two_files.zip b/integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/one_error_two_files.zip
new file mode 100644
index 0000000000..fe7925fe25
--- /dev/null
+++ b/integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/one_error_two_files.zip
Binary files differ
diff --git a/integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/one_error_two_files_expect b/integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/one_error_two_files_expect
new file mode 100644
index 0000000000..d4b2ef4d2e
--- /dev/null
+++ b/integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/one_error_two_files_expect
@@ -0,0 +1 @@
+"one_error.tgz":[{"level":"ERROR","message":"ERROR: [HELM VALIDATOR]: Error: template: mychartname/templates/test.yaml:2:18: executing \"mychartname/templates/test.yaml\" at <.Values.image.repository>: nil pointer evaluating interface {}.repository"},{"level":"WARNING","message":"WARNING: [HELM VALIDATOR]: [ERROR] templates/: template: mychartname/templates/test.yaml:2:18: executing \"mychartname/templates/test.yaml\" at <.Values.image.repository>: nil pointer evaluating interface {}.repository"}]
diff --git a/integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/package_invalid_nil_pointer_render_error.zip b/integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/package_invalid_nil_pointer_render_error.zip
new file mode 100644
index 0000000000..851ee27367
--- /dev/null
+++ b/integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/package_invalid_nil_pointer_render_error.zip
Binary files differ
diff --git a/integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/package_invalid_nil_pointer_render_error_expect b/integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/package_invalid_nil_pointer_render_error_expect
new file mode 100644
index 0000000000..b8d93186fb
--- /dev/null
+++ b/integration-tests/src/test/resources/Files/CNFs/helm_validator/invalid/package_invalid_nil_pointer_render_error_expect
@@ -0,0 +1 @@
+"one-lint-one-render-error-apiVersion-v2.tgz":[{"level":"ERROR","message":"ERROR: [HELM VALIDATOR]: Error: template: mychartname/templates/test.yaml:2:18: executing \"mychartname/templates/test.yaml\" at <.Values.image.repository>: nil pointer evaluating interface {}.repository"},{"level":"WARNING","message":"WARNING: [HELM VALIDATOR]: [ERROR] templates/: template: mychartname/templates/test.yaml:2:18: executing \"mychartname/templates/test.yaml\" at <.Values.image.repository>: nil pointer evaluating interface {}.repository"}]
diff --git a/integration-tests/src/test/resources/Files/CNFs/helm_validator/package_valid.zip b/integration-tests/src/test/resources/Files/CNFs/helm_validator/package_valid.zip
new file mode 100644
index 0000000000..abe94e6616
--- /dev/null
+++ b/integration-tests/src/test/resources/Files/CNFs/helm_validator/package_valid.zip
Binary files differ
diff --git a/integration-tests/src/test/resources/Files/CNFs/helm_validator/valid_two_files.zip b/integration-tests/src/test/resources/Files/CNFs/helm_validator/valid_two_files.zip
new file mode 100644
index 0000000000..508f3f8388
--- /dev/null
+++ b/integration-tests/src/test/resources/Files/CNFs/helm_validator/valid_two_files.zip
Binary files differ
diff --git a/integration-tests/src/test/resources/Files/CNFs/helm_validator/with_warnings/one_warning_two_files.zip b/integration-tests/src/test/resources/Files/CNFs/helm_validator/with_warnings/one_warning_two_files.zip
new file mode 100644
index 0000000000..76530d43a1
--- /dev/null
+++ b/integration-tests/src/test/resources/Files/CNFs/helm_validator/with_warnings/one_warning_two_files.zip
Binary files differ
diff --git a/integration-tests/src/test/resources/Files/CNFs/helm_validator/with_warnings/one_warning_two_files_expect b/integration-tests/src/test/resources/Files/CNFs/helm_validator/with_warnings/one_warning_two_files_expect
new file mode 100644
index 0000000000..6e895ae278
--- /dev/null
+++ b/integration-tests/src/test/resources/Files/CNFs/helm_validator/with_warnings/one_warning_two_files_expect
@@ -0,0 +1 @@
+"one_warning.tgz":[{"level":"WARNING","message":"WARNING: [HELM VALIDATOR]: [WARNING] templates/: directory not found"}]
diff --git a/integration-tests/src/test/resources/ci/testSuites/backend/helmValidatorTests.xml b/integration-tests/src/test/resources/ci/testSuites/backend/helmValidatorTests.xml
index e69785d397..01d4095153 100644
--- a/integration-tests/src/test/resources/ci/testSuites/backend/helmValidatorTests.xml
+++ b/integration-tests/src/test/resources/ci/testSuites/backend/helmValidatorTests.xml
@@ -5,6 +5,12 @@
<parameter name="makeToscaValidation" value="true"/>
<test name="HelmValidatorTests">
<classes>
+ <class name="org.onap.sdc.backend.ci.tests.sanity.Onboard">
+ <methods>
+ <include name="onboardCNFWithHelmValidatorTest"/>
+ <include name="onboardCNFWithHelmValidatorShouldFailTest"/>
+ </methods>
+ </class>
</classes>
</test>
</suite>
diff --git a/integration-tests/src/test/resources/ci/testSuites/backend/onapApiSanity.xml b/integration-tests/src/test/resources/ci/testSuites/backend/onapApiSanity.xml
index 97537986cb..8ce016d09f 100644
--- a/integration-tests/src/test/resources/ci/testSuites/backend/onapApiSanity.xml
+++ b/integration-tests/src/test/resources/ci/testSuites/backend/onapApiSanity.xml
@@ -5,7 +5,12 @@
<parameter name="makeToscaValidation" value="true"/>
<test name="ExternalApis">
<classes>
- <class name="org.onap.sdc.backend.ci.tests.sanity.Onboard"/>
+ <class name="org.onap.sdc.backend.ci.tests.sanity.Onboard">
+ <methods>
+ <exclude name="onboardCNFWithHelmValidatorTest"/>
+ <exclude name="onboardCNFWithHelmValidatorShouldFailTest"/>
+ </methods>
+ </class>
</classes>
</test>
</suite>
diff --git a/integration-tests/src/test/resources/ci/testSuites/frontend/helmValidatorTests.xml b/integration-tests/src/test/resources/ci/testSuites/frontend/helmValidatorTests.xml
index ac44641767..2e171e970f 100644
--- a/integration-tests/src/test/resources/ci/testSuites/frontend/helmValidatorTests.xml
+++ b/integration-tests/src/test/resources/ci/testSuites/frontend/helmValidatorTests.xml
@@ -6,6 +6,13 @@
<test name="helmValidatorTests">
<classes>
+ <class name="org.onap.sdc.frontend.ci.tests.execute.sanity.OnboardingFlowsUi">
+ <methods>
+ <include name="onapOnboardVSPWithHelmValidationSuccessfulWithoutErrorsAndWarnings"/>
+ <include name="onapOnboardVSPWithHelmValidationSuccessfulWithWarnings"/>
+ <include name="onapOnboardVSPWithHelmValidationUnsuccessfulWithErrors"/>
+ </methods>
+ </class>
</classes>
</test>
</suite>