Skip to content

Feature/java integration tests #300

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 66 commits into from
Jun 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
5939172
adding java integration tests for single domain use case which works …
vanajamukkara May 10, 2018
f4de1d5
changing profile name to java-integration-tests
vanajamukkara May 14, 2018
5104899
adding comments for property files
vanajamukkara May 16, 2018
4f9c179
remove dangling images
vanajamukkara May 16, 2018
843f03d
Merge branch 'develop' of https://github.com/oracle/weblogic-kubernet…
vanajamukkara May 17, 2018
e925957
changes for Ryan comments on PR
vanajamukkara May 19, 2018
9e67d50
fixing typo
vanajamukkara May 19, 2018
88e2fb2
changes for Tom M review comments
vanajamukkara May 23, 2018
9f7a290
Merge branch 'develop' of https://github.com/oracle/weblogic-kubernet…
vanajamukkara May 24, 2018
cd0e469
rename integration-tests/src/integration-tests to integration-tests/s…
vanajamukkara May 24, 2018
ef0d30d
formatting changes
vanajamukkara May 24, 2018
f9e8b84
changes for the pull request review comments
vanajamukkara May 25, 2018
3a4c102
wercker automation
vanajamukkara Jun 5, 2018
e358b12
install pre-reqs for maven
vanajamukkara Jun 5, 2018
4021e3d
fixing typo for profile
vanajamukkara Jun 6, 2018
53811ca
fix script error
vanajamukkara Jun 6, 2018
02b41f8
changing secret names for java tests
vanajamukkara Jun 6, 2018
d97c3e6
fixing script error
vanajamukkara Jun 6, 2018
28b86b6
chmod pv_root only for manual runs
vanajamukkara Jun 6, 2018
95eab5e
adding docker registry secret
vanajamukkara Jun 6, 2018
c5cde58
adding docker registry secret
vanajamukkara Jun 6, 2018
36e40ee
create namespace
vanajamukkara Jun 6, 2018
53480e5
create namespace
vanajamukkara Jun 6, 2018
50ec4ef
create pvroot
vanajamukkara Jun 6, 2018
009c2ac
debug statment
vanajamukkara Jun 6, 2018
a3575f0
using admin servername in t3 url inside pod
vanajamukkara Jun 7, 2018
4767d20
using admin servername in t3 url inside pod
vanajamukkara Jun 7, 2018
0663946
changes to use ExecCommand and ExecResult
vanajamukkara Jun 10, 2018
c75bfb6
adding debug statement
vanajamukkara Jun 10, 2018
b77684d
adding debug statement
vanajamukkara Jun 10, 2018
39a36bf
docker password in double quotes
vanajamukkara Jun 10, 2018
571bf77
use nodeport host for url
vanajamukkara Jun 10, 2018
2e6156a
get replica cnt for load balance check
vanajamukkara Jun 10, 2018
566a7f0
adding java integration tests for single domain use case which works …
vanajamukkara May 10, 2018
2b8ce2c
changing profile name to java-integration-tests
vanajamukkara May 14, 2018
afcbc9f
adding comments for property files
vanajamukkara May 16, 2018
522e412
remove dangling images
vanajamukkara May 16, 2018
0c46a30
changes for Ryan comments on PR
vanajamukkara May 19, 2018
f9f6eea
fixing typo
vanajamukkara May 19, 2018
d62063d
changes for Tom M review comments
vanajamukkara May 23, 2018
c6c2038
rename integration-tests/src/integration-tests to integration-tests/s…
vanajamukkara May 24, 2018
f79bbc0
formatting changes
vanajamukkara May 24, 2018
9a61388
changes for the pull request review comments
vanajamukkara May 25, 2018
1940972
wercker automation
vanajamukkara Jun 5, 2018
56370f8
install pre-reqs for maven
vanajamukkara Jun 5, 2018
6c939a0
fixing typo for profile
vanajamukkara Jun 6, 2018
881094d
fix script error
vanajamukkara Jun 6, 2018
ae5b85d
changing secret names for java tests
vanajamukkara Jun 6, 2018
592df05
fixing script error
vanajamukkara Jun 6, 2018
d4efe98
chmod pv_root only for manual runs
vanajamukkara Jun 6, 2018
a7909f4
adding docker registry secret
vanajamukkara Jun 6, 2018
d5c520b
adding docker registry secret
vanajamukkara Jun 6, 2018
b70c249
create namespace
vanajamukkara Jun 6, 2018
eab8cf5
create namespace
vanajamukkara Jun 6, 2018
7c59381
create pvroot
vanajamukkara Jun 6, 2018
5f52972
debug statment
vanajamukkara Jun 6, 2018
a9df293
using admin servername in t3 url inside pod
vanajamukkara Jun 7, 2018
7efe44c
using admin servername in t3 url inside pod
vanajamukkara Jun 7, 2018
2d8f391
changes to use ExecCommand and ExecResult
vanajamukkara Jun 10, 2018
6b4363f
adding debug statement
vanajamukkara Jun 10, 2018
2eae48b
adding debug statement
vanajamukkara Jun 10, 2018
17ad685
docker password in double quotes
vanajamukkara Jun 10, 2018
8f513f6
use nodeport host for url
vanajamukkara Jun 10, 2018
f67c802
get replica cnt for load balance check
vanajamukkara Jun 10, 2018
03e2f73
Merge branch 'feature/java-integration-tests' of https://github.com/o…
vanajamukkara Jun 12, 2018
448474b
Merge branch 'develop' of https://github.com/oracle/weblogic-kubernet…
vanajamukkara Jun 12, 2018
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
194 changes: 194 additions & 0 deletions integration-tests/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
<!-- Copyright 2018, Oracle Corporation and/or its affiliates. All rights
reserved. -->
<!-- Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>oracle.kubernetes</groupId>
<artifactId>operator-parent</artifactId>
<version>1.0</version>
</parent>

<groupId>oracle.kubernetes</groupId>
<artifactId>operator-integration-tests</artifactId>
<version>1.0</version>

<description>Oracle Weblogic Server Kubernetes Operator</description>
<name>operator-integration-tests</name>
<packaging>jar</packaging>

<url>https://oracle.github.io/weblogic-kubernetes-operator</url>
<inceptionYear>2017</inceptionYear>
<licenses>
<license>
<name>The Universal Permissive License (UPL), Version 1.0</name>
<url>https://github.com/oracle/weblogic-kubernetes-operator/blob/master/LICENSE</url>
</license>
</licenses>
<dependencies>
<!-- test dependencies -->
<dependency>
<!-- note: need to include this before junit since junit includes an obsolete
version of hamcrest -->
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-junit</artifactId>
<version>2.0.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>${jersey-version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-processing</artifactId>
<version>${jersey-version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>${jersey-version}</version>
</dependency>
</dependencies>


<profiles>

<profile>
<id>java-integration-tests</id>
<properties>
<src-integration-test>${project.basedir}/src/test/java</src-integration-test>
<resource-integration-test>${project.basedir}/src/test/resources</resource-integration-test>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
<execution><!-- pull or build images, create secrets, etc -->
<id>setupenv</id>
<phase>pre-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${resource-integration-test}/setupenv.sh</executable>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>add-test-source</id>
<phase>generate-test-resources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>${src-integration-test}</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-test-resource</id>
<phase>generate-test-resources</phase>
<goals>
<goal>add-test-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>${resource-integration-test}</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.20.1</version>
<configuration> <!-- run tests in parallel -->
<encoding>UTF-8</encoding>
<argLine>${failsafeArgLine}</argLine>
<failIfNoTests>false</failIfNoTests>
<systemPropertyVariables>
<!-- Add any system properties here -->
<!--<project.build.directory>${project.build.directory}</project.build.directory> -->
<!--<weblogic.operator.root.directory>${basedir}/..</weblogic.operator.root.directory> -->
<!--<TAGS>${env.TAGS}</TAGS> -->
<maxThreads>3</maxThreads>
</systemPropertyVariables>
</configuration>

<executions>
<execution>
<id>integration-tests</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<phase>integration-test</phase>
<configuration>
<skipTests>false</skipTests>
</configuration>
</execution>
<execution>
<id>acceptance-test</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<phase>integration-test</phase>
<configuration>
<!-- do not run unit or integration tests -->
<excludes>
<exclude>**/*Test.java</exclude>
<exclude>**/IT*.java</exclude>
</excludes>
<!-- just run acceptance tests -->
<!-- includes> <include>**/*AT.java</include> </includes -->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<surefireArgLine></surefireArgLine>
<failsafeArgLine></failsafeArgLine>
</properties>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
// Copyright 2018, Oracle Corporation and/or its affiliates. All rights reserved.
// Licensed under the Universal Permissive License v 1.0 as shown at
// http://oss.oracle.com/licenses/upl.

package oracle.kubernetes.operator;

import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Properties;
import java.util.logging.Logger;
import oracle.kubernetes.operator.utils.ExecCommand;
import oracle.kubernetes.operator.utils.ExecResult;
import oracle.kubernetes.operator.utils.TestUtils;

/**
* Base class which contains common methods to create/shutdown operator and domain. IT tests can
* extend this class.
*/
public class BaseTest {
public static final Logger logger = Logger.getLogger("OperatorIT", "OperatorIT");

private static String resultRoot = "";
private static String pvRoot = "";
// private static String resultDir = "";
private static String userProjectsDir = "";
private static String projectRoot = "";
private static String username = "weblogic";
private static String password = "welcome1";
private static int maxIterationsPod = 50;
private static int waitTimePod = 5;
private static String leaseId = "";

private static Properties appProps;

public static void initialize(String appPropsFile) throws Exception {

// load app props defined
appProps = TestUtils.loadProps(appPropsFile);

// check app props
String baseDir = appProps.getProperty("baseDir");
if (baseDir == null) {
throw new IllegalArgumentException("FAILURE: baseDir is not set");
}
username = appProps.getProperty("username", username);
password = appProps.getProperty("password", password);
maxIterationsPod =
new Integer(appProps.getProperty("maxIterationsPod", "" + maxIterationsPod)).intValue();
waitTimePod = new Integer(appProps.getProperty("waitTimePod", "" + waitTimePod)).intValue();
if (System.getenv("RESULT_ROOT") != null) {
resultRoot = System.getenv("RESULT_ROOT");
} else {
resultRoot = baseDir + "/" + System.getProperty("user.name") + "/wl_k8s_test_results";
}
if (System.getenv("PV_ROOT") != null) {
pvRoot = System.getenv("PV_ROOT");
} else {
pvRoot = resultRoot;
}
if (System.getenv("LEASE_ID") != null) {
leaseId = System.getenv("LEASE_ID");
}
// resultDir = resultRoot + "/acceptance_test_tmp";
userProjectsDir = resultRoot + "/acceptance_test_tmp/user-projects";
projectRoot = System.getProperty("user.dir") + "/..";
logger.info("RESULT_ROOT =" + resultRoot);
logger.info("PV_ROOT =" + pvRoot);
logger.info("userProjectsDir =" + userProjectsDir);
logger.info("projectRoot =" + projectRoot);

logger.info("Env var RESULT_ROOT " + System.getenv("RESULT_ROOT"));
logger.info("Env var PV_ROOT " + System.getenv("PV_ROOT"));
logger.info("Env var K8S_NODEPORT_HOST " + System.getenv("K8S_NODEPORT_HOST"));
logger.info("Env var IMAGE_NAME_OPERATOR= " + System.getenv("IMAGE_NAME_OPERATOR"));
logger.info("Env var IMAGE_TAG_OPERATOR " + System.getenv("IMAGE_TAG_OPERATOR"));
logger.info(
"Env var IMAGE_PULL_POLICY_OPERATOR " + System.getenv("IMAGE_PULL_POLICY_OPERATOR"));
logger.info(
"Env var IMAGE_PULL_SECRET_OPERATOR " + System.getenv("IMAGE_PULL_SECRET_OPERATOR"));
logger.info(
"Env var IMAGE_PULL_SECRET_WEBLOGIC " + System.getenv("IMAGE_PULL_SECRET_WEBLOGIC"));

// create resultRoot, PVRoot, etc
Files.createDirectories(Paths.get(resultRoot));

if (System.getenv("WERCKER") == null && System.getenv("JENKINS") == null) {
logger.info("Creating PVROOT " + pvRoot);
Files.createDirectories(Paths.get(pvRoot));
ExecResult result = ExecCommand.exec("chmod 777 " + pvRoot);
if (result.exitValue() != 0) {
throw new RuntimeException(
"FAILURE: Couldn't change permissions for PVROOT " + result.stderr());
}
}

// Files.createDirectories(Paths.get(resultDir));

Files.createDirectories(Paths.get(userProjectsDir));
}

public static String getResultRoot() {
return resultRoot;
}

public static String getPvRoot() {
return pvRoot;
}

public static String getUserProjectsDir() {
return userProjectsDir;
}

public static String getProjectRoot() {
return projectRoot;
}

public static String getUsername() {
return username;
}

public static String getPassword() {
return password;
}

public static int getMaxIterationsPod() {
return maxIterationsPod;
}

public static int getWaitTimePod() {
return waitTimePod;
}

public static Properties getAppProps() {
return appProps;
}

public static String getLeaseId() {
return leaseId;
}

protected void logTestBegin(String testName) throws Exception {
logger.info("+++++++++++++++++++++++++++++++++---------------------------------+");
logger.info("BEGIN " + testName);
// renew lease at the beginning for every test method, leaseId is set only for Wercker
TestUtils.renewK8sClusterLease(getProjectRoot(), getLeaseId());
}
}
Loading