diff options
Diffstat (limited to 'integration-tests/src/test')
7 files changed, 53 insertions, 3 deletions
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 a743521bea..88b1a661b9 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 @@ -1,6 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix Foundation + * 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. @@ -76,6 +77,13 @@ public final class OnboardingDataProviders { return provideData(fileNamesFromFolder, FileHandling.getXnfRepositoryPath(XnfTypeEnum.CNF)); } + @DataProvider(name = "Invalid_CNF_List", parallel = true) + 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)); + } + @DataProvider(name = "Single_VNF", parallel = true) private static Object[][] singleVNF() { final List<String> fileNamesFromFolder = OnboardingUtils.getXnfNamesFileList(XnfTypeEnum.VNF); 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 a16fa3e487..d67390e304 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 @@ -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. @@ -21,6 +22,8 @@ package org.onap.sdc.backend.ci.tests.sanity; +import static org.testng.Assert.assertThrows; + import com.aventstack.extentreports.Status; import fj.data.Either; import org.junit.Rule; @@ -84,6 +87,12 @@ public class Onboard extends ComponentBaseTest { runOnboardToDistributionFlow(filePath, cnfFile, ResourceTypeEnum.VF); } + @Test(dataProviderClass = OnboardingDataProviders.class, dataProvider = "Invalid_CNF_List") + public void onboardCNFFlowShouldFailForInvalidHelmPackage(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/OnboardingUtils.java b/integration-tests/src/test/java/org/onap/sdc/backend/ci/tests/utils/general/OnboardingUtils.java index 1357dc42b3..ad620ef75f 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 @@ -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. @@ -20,6 +21,7 @@ package org.onap.sdc.backend.ci.tests.utils.general; +import java.io.File; 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; @@ -104,7 +106,9 @@ public class OnboardingUtils { "1-2017-404_vUSP_vCCF_AIC3.0-(VOIP)_v6.0.zip", "1-2017389vtsbc4vf-(VOIP)_v11.0.zip" ); - + + private static final String INVALID_XNFS_SUBPATH = "invalid"; + public static String handleFilename(String heatFileName) { final String namePrefix = String.format("%sVF%s", ElementFactory.getResourcePrefix(), "Onboarded-"); final String nameSuffix = "-" + getShortUUID(); @@ -123,7 +127,7 @@ public class OnboardingUtils { String vnfName = namePrefix + subHeatFileName + nameSuffix; return vnfName; } - + public static String getShortUUID() { return UUID.randomUUID().toString().split("-")[0]; @@ -190,6 +194,15 @@ public class OnboardingUtils { } /** + * @return + * The method returns names list of invalid XNF packages from Files directory under sdc repository + */ + public static List<String> getInvalidXnfNamesFileList(XnfTypeEnum xnfTypeEnum) { + String filepath = FileHandling.getXnfRepositoryPath(xnfTypeEnum) + File.separator + INVALID_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 */ @@ -238,4 +251,3 @@ public class OnboardingUtils { } } -
\ No newline at end of file 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 d8dc5f94c3..3a9fd4d9a3 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 @@ -3,6 +3,7 @@ * SDC * ================================================================================ * Copyright (C) 2019 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. @@ -65,6 +66,15 @@ public class OnbordingDataProviders { return provideData(fileNamesFromFolder, FileHandling.getCnfRepositoryPath()); } + @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()); + } + @DataProvider(name = "updateList") private static Object[][] updateList() throws Exception { 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 9327d6ce0c..73c6d7cf6d 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 @@ -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. @@ -72,6 +73,7 @@ import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.testng.Assert; import org.testng.AssertJUnit; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Optional; @@ -473,6 +475,14 @@ public class OnboardingFlowsUi extends SetupCDTest { runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, cnfFile); } + @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "Invalid_CNF_List") + public void onboardCNFTestShouldFailForInvalidHelmPackage(String filePath, String cnfFile) { + setLog(cnfFile); + ResourceReqDetails resourceReqDetails = ElementFactory.getDefaultResource(); + ServiceReqDetails serviceReqDetails = ElementFactory.getDefaultService(); + Assert.assertThrows(() -> runOnboardToDistributionFlow(resourceReqDetails, serviceReqDetails, filePath, cnfFile)); + } + @Test(dataProviderClass = OnbordingDataProviders.class, dataProvider = "VNF_List") public void onboardVNFShotFlow(String filePath, String vnfFile) throws Exception { setLog(vnfFile); diff --git a/integration-tests/src/test/resources/Files/CNFs/invalid/helm-package-invalid-missing-flag-isbase.zip b/integration-tests/src/test/resources/Files/CNFs/invalid/helm-package-invalid-missing-flag-isbase.zip Binary files differnew file mode 100644 index 0000000000..45a69e8b58 --- /dev/null +++ b/integration-tests/src/test/resources/Files/CNFs/invalid/helm-package-invalid-missing-flag-isbase.zip diff --git a/integration-tests/src/test/resources/ci/testSuites/frontend/onapUiSanity.xml b/integration-tests/src/test/resources/ci/testSuites/frontend/onapUiSanity.xml index c53dd4a73b..db352d3848 100644 --- a/integration-tests/src/test/resources/ci/testSuites/frontend/onapUiSanity.xml +++ b/integration-tests/src/test/resources/ci/testSuites/frontend/onapUiSanity.xml @@ -20,6 +20,7 @@ <methods> <include name="onapOnboardVNFflow"/> <include name="onboardCNFTest"/> + <include name="onboardCNFTestShouldFailForInvalidHelmPackage"/> <include name="onapOnboardVSPValidationsSanityFlow"/> <include name="onboardPNFSoftwareInformationFlow"/> </methods> |