Skip to content

Added integration test for sample #1200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,6 @@ private void verifyFDiscoverDomainWithRequiredArgument(String expectedModelFile)
checkContents.add("SourcePath: wlsdeploy/applications/simple-app.war");
verifyModelFileContents(expectedModelFile, checkContents);
}

/**
* test discoverDomain.sh with -model_file argument
* @throws Exception - if any error occurs
Expand All @@ -534,7 +533,7 @@ void test18DiscoverDomainWithModelFile(TestInfo testInfo) throws Exception {
Path discoveredArchive = getTestOutputPath(testInfo).resolve("discoveredArchive.zip");
Path discoveredModelFile = getTestOutputPath(testInfo).resolve("discoveredRestrictedJRFD1.yaml");
String cmd = discoverDomainScript + " -oracle_home " + mwhome_12213 + " -domain_home " +
domainParentDir + FS + "restrictedJRFD1 -archive_file " + discoveredArchive +
domainParentDir + FS + "restrictedJRFD1 -archive_file " + discoveredArchive +
" -model_file " + discoveredModelFile;
try (PrintWriter out = getTestMethodWriter(testInfo)) {
CommandResult result = Runner.run(cmd, getTestMethodEnvironment(testInfo), out);
Expand Down Expand Up @@ -925,7 +924,46 @@ void test30OnlineUpdateApp(TestInfo testInfo) throws Exception {


}
/**
* test discoverDomain.sh that model can create a working domain
* @throws Exception - if any error occurs
*/
@DisplayName("Test 31: Discover domain and then create a new domain from the model")
@Order(31)
@Tag("gate")
@Test
void test31DiscoverDomainWithModelFile(TestInfo testInfo) throws Exception {
Path discoveredArchive = getTestOutputPath(testInfo).resolve("discoveredArchive.zip");
Path discoveredModelFile = getTestOutputPath(testInfo).resolve("discoveredModel.yaml");
Path discoveredVariableFile = getTestOutputPath(testInfo).resolve("discoveredVariable.properties");
String cmd = discoverDomainScript + " -oracle_home " + mwhome_12213 + " -domain_home " +
domainParentDir + FS + "domain2 -archive_file " + discoveredArchive +
" -model_file " + discoveredModelFile + " -variable_file " + discoveredVariableFile;
try (PrintWriter out = getTestMethodWriter(testInfo)) {
CommandResult result = Runner.run(cmd, getTestMethodEnvironment(testInfo), out);

verifyResult(result, "discoverDomain.sh completed successfully");

// verify model file
verifyModelFile(discoveredModelFile.toString());

String domainHome = domainParentDir + FS + "createDomainFromDiscover";
cmd = createDomainScript + " -oracle_home " + mwhome_12213 + " -domain_home " +
domainHome + " -archive_file " + discoveredArchive +
" -model_file " + discoveredModelFile + " -variable_file " + getSampleVariableFile();
result = Runner.run(cmd, getTestMethodEnvironment(testInfo), out);

verifyResult(result, "createDomain.sh completed successfully");

setUpBootProperties(domainHome, "AdminServer", "weblogic", "welcome1");
Path adminServerOut = getTestOutputPath(testInfo).resolve("AdminServer.out");
boolean isServerUp = startAdminServer(domainHome, adminServerOut );
if (!isServerUp) {
throw new Exception("Admin server did not come up after createDomain from discoverDomain");
}
stopAdminServer(domainHome);
}
}

private boolean startAdminServer(String domainHome, Path outputFile) throws Exception {
boolean isServerUp = false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# These variables are used for substitution in the WDT model file.
# Any port that will be exposed through Docker is put in this file.
# The sample Dockerfile will get the ports from this file and not the WDT model.
AdminUserName=weblogic
AdminPassword=welcome1
SecurityConfig.NodeManagerUsername=weblogic
DOMAIN_NAME=domain1
ADMIN_PORT=7001
ADMIN_NAME=admin-server
Expand Down