Skip to content

Commit

Permalink
Merge pull request #482 from kasunbg/change-testplan-dir
Browse files Browse the repository at this point in the history
Rename the productName in local-is-deployment test scripts
  • Loading branch information
kasunbg committed Feb 15, 2018
2 parents 08a15c1 + 9f26f87 commit 5446950
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class TestGridConstants {

// Logging constants
public static final String TEST_LOG_FILE_NAME = "test-run.log";
public static final String PRODUCT_TEST_PLANS_DIR = "test-plans";
public static final String TESTGRID_HOME_ENV = "TESTGRID_HOME";
public static final String TESTGRID_HOME_SYSTEM_PROPERTY = "testgrid.home";
public static final Path DEFAULT_TESTGRID_HOME = Paths.get(System.getProperty("user.home"), ".testgrid");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
import java.util.Map;
import java.util.Set;

import static org.wso2.testgrid.common.TestGridConstants.PRODUCT_TEST_PLANS_DIR;

/**
* Responsible for generating the infrastructure plan and persisting them in the file system.
*
Expand Down Expand Up @@ -213,33 +215,21 @@ private List<Map<String, Object>> toConfigAwareInfrastructureCombination(Set<Inf
*/
private String createTestPlanGenDirectory(Product product) throws CommandExecutionException {
try {
String directoryName = product.getId();
String directoryName = product.getName();
String testGridHome = TestGridUtil.getTestGridHomePath();
Path directory = Paths.get(testGridHome, directoryName).toAbsolutePath();
Path directory = Paths.get(testGridHome, directoryName, PRODUCT_TEST_PLANS_DIR).toAbsolutePath();

// if the directory exists, remove it
removeDirectories(directory);

logger.info(StringUtil.concatStrings("Creating test directory : ", directory.toString()));
Path createdDirectory = createDirectories(directory);
logger.info(StringUtil.concatStrings("Directory created : ", createdDirectory.toAbsolutePath().toString()));
return createdDirectory.toAbsolutePath().toString();
Path createdDirectory = Files.createDirectories(directory).toAbsolutePath();
logger.info(StringUtil.concatStrings("Test plans dir: ", createdDirectory.toString()));
return createdDirectory.toString();
} catch (IOException e) {
throw new CommandExecutionException("Error in creating infra generation directory", e);
}
}

/**
* Creates the given directory structure.
*
* @param directory directory structure to create
* @return created directory structure
* @throws IOException thrown when error on creating directory structure
*/
private Path createDirectories(Path directory) throws IOException {
return Files.createDirectories(directory.toAbsolutePath());
}

/**
* Removes the given directory structure if exists.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@ private Optional<String> getTestPlanGenFilePath(Product product) throws IOExcept
* @return path for the generated test plan YAML files directory
*/
private Path getTestPlanGenLocation(Product product) throws IOException {
String directoryName = product.getId();
String directoryName = product.getName();
String testGridHome = TestGridUtil.getTestGridHomePath();
return Paths.get(testGridHome, directoryName).toAbsolutePath();
return Paths.get(testGridHome, directoryName, TestGridConstants.PRODUCT_TEST_PLANS_DIR).toAbsolutePath();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test-scripts/local-is-deployment/test-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
################################################################################

# TestGrid Test Configuration Parameters
productName: "wso2is-5.4.0-LTS"
productName: "wso2is-local-deployment"
deploymentPatterns:
- "pattern-2"
infraParams:
Expand Down

0 comments on commit 5446950

Please sign in to comment.