Skip to content

Commit db40d06

Browse files
committed
made changes based on co-worker's review comments
1 parent 6732f95 commit db40d06

File tree

3 files changed

+25
-27
lines changed

3 files changed

+25
-27
lines changed

integration-tests/README.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,6 @@ Configuration Overrides Usecases
102102
| Primary server repick | a backup server becomes the primary server when a primary server fails|
103103
| HTTP session nigration | verify in-memory HTTP session State replication |
104104

105-
| Server Discovery | Use Case |
106-
| --- | --- |
107-
| Discover a newly started server | restart Operator and verify that it discovers to newly started server by applying a modified domain.yaml |
108-
| Discover running servers | restart Operator and verify that it discovers running servers and a newly started server by scaling up cluster |
109-
| Discover running servers | restart both Operator and admin server. Verify Operator connects to newly started server by scaling up cluster |
110-
| Liveness probe | restart Operator and verify the liveness probe by killing all managed servers in the cluster |
111-
| Liveness probe | Verify the liveness probe by killing a managed server |
112-
113105
Use Cases covered in integration tests for the operator is available [here](USECASES.MD)
114106

115107
# Directory Configuration and Structure

integration-tests/USECASES.MD

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,11 @@ Configuration Overrides Usecases
9090
| --- | --- |
9191
| Primary Server Repick | A backup server becomes the primary server when a primary server fails|
9292
| HTTP Session Migration | Verify in-memory HTTP session State replication |
93+
94+
| Server Discovery | Use Case |
95+
| --- | --- |
96+
| Discover a newly started server | stop operator and apply the modified domain.yaml with replicas count increated, restart Operator and verify that the cluster is scaled up accordingly |
97+
| Discover running servers | restart Operator and verify that it discovers running servers and a newly started server by scaling up cluster |
98+
| Discover running servers | restart both Operator and admin server. Verify Operator connects to newly started server by scaling up cluster |
99+
| Liveness probe | restart Operator and verify the liveness probe by killing all managed servers in the cluster |
100+
| Liveness probe | Verify the liveness probe by killing a managed server |

integration-tests/src/test/java/oracle/kubernetes/operator/ITServerDiscovery.java

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
import java.nio.file.StandardCopyOption;
1212
import java.util.Map;
1313
import oracle.kubernetes.operator.utils.Domain;
14-
import oracle.kubernetes.operator.utils.ExecCommand;
15-
import oracle.kubernetes.operator.utils.ExecResult;
1614
import oracle.kubernetes.operator.utils.Operator;
1715
import oracle.kubernetes.operator.utils.TestUtils;
1816
import org.junit.AfterClass;
@@ -101,8 +99,8 @@ public static void staticUnPrepare() throws Exception {
10199
}
102100

103101
/**
104-
* Stop Operator. Start a managed server by applying a modified domain.yaml. Restart Operator and
105-
* verify that it connects to this newly started managed server.
102+
* Stop operator and apply the modified domain.yaml with replicas count increated. Restart
103+
* operator and make sure the cluster is scaled up accordingly.
106104
*
107105
* @throws Exception
108106
*/
@@ -117,25 +115,25 @@ public void testOPConnToNewMS() throws Exception {
117115

118116
String cmd = "kubectl apply -f " + testDomainYamlFile;
119117
logger.info("Start a new managed server, managed-server3 using command:\n" + cmd);
120-
ExecResult result = ExecCommand.exec(cmd);
118+
TestUtils.exec(cmd);
121119

122120
logger.info("Start the Operator");
123121
operator.startUsingReplicas();
124122

125123
logger.info("Check the newly created managed-server3 is running");
126124
int replicas = 3;
127-
varifyPodReady(replicas);
125+
verifyPodReady(replicas);
128126

129127
// restore the test env
130128
int msDecrNum = 1;
131-
scaleDownAndVarify(msDecrNum);
129+
scaleDownAndverify(msDecrNum);
132130

133131
logger.info("SUCCESS - " + testMethodName);
134132
}
135133

136134
/**
137135
* Stop and restart Operator and verify that it discovers running servers and a newly started
138-
* server by scaling up cluster. Verify that the cluster scale up is noy impacted.
136+
* server by scaling up cluster. Verify that the cluster scale up is not impacted.
139137
*
140138
* @throws Exception
141139
*/
@@ -149,11 +147,11 @@ public void testOPReconnToRunningMSAndScaleUp() throws Exception {
149147
operator.restartUsingReplicas();
150148

151149
int msIncrNum = 1;
152-
scaleUpAndVarify(msIncrNum);
150+
scaleUpAndverify(msIncrNum);
153151

154152
// restore the test env
155153
int msDecrNum = 1;
156-
scaleDownAndVarify(msDecrNum);
154+
scaleDownAndverify(msDecrNum);
157155

158156
logger.info("SUCCESS - " + testMethodName);
159157
}
@@ -181,7 +179,7 @@ public void testOPAdminReconnToDomain() throws Exception {
181179

182180
String cmd = "kubectl delete po/" + adminServerPodName + " -n " + domainNS;
183181
logger.info("Stop admin server <" + adminServerPodName + "> using command:\n" + cmd);
184-
ExecResult result = ExecCommand.exec(cmd);
182+
TestUtils.exec(cmd);
185183

186184
logger.info("Checking if admin pod <" + adminServerPodName + "> is deleted");
187185
TestUtils.checkPodDeleted(adminServerPodName, domainNS);
@@ -193,11 +191,11 @@ public void testOPAdminReconnToDomain() throws Exception {
193191
TestUtils.checkPodReady(adminServerPodName, domainNS);
194192

195193
int msIncrNum = 1;
196-
scaleUpAndVarify(msIncrNum);
194+
scaleUpAndverify(msIncrNum);
197195

198196
// restore the test env
199197
int msDecrNum = 1;
200-
scaleDownAndVarify(msDecrNum);
198+
scaleDownAndverify(msDecrNum);
201199

202200
logger.info("SUCCESS - " + testMethodName);
203201
}
@@ -228,7 +226,7 @@ public void testOPMSReconnToDomain() throws Exception {
228226
String msPodName = domainUid + "-" + managedServerNameBase + i;
229227
String cmd = "kubectl delete po/" + msPodName + " -n " + domainNS;
230228
logger.info("Stop managed server <" + msPodName + "> using command:\n" + cmd);
231-
ExecResult result = ExecCommand.exec(cmd);
229+
TestUtils.exec(cmd);
232230

233231
logger.info("Checking if ms pod <" + msPodName + "> is deleted");
234232
TestUtils.checkPodDeleted(msPodName, domainNS);
@@ -267,7 +265,7 @@ public void testOPRestartDeadMS() throws Exception {
267265
String msPodName = domainUid + "-" + managedServerNameBase + "1";
268266
String cmd = "kubectl delete po/" + msPodName + " -n " + domainNS;
269267
logger.info("Stop managed server <" + msPodName + "> using command:\n" + cmd);
270-
ExecResult result = ExecCommand.exec(cmd);
268+
TestUtils.exec(cmd);
271269

272270
logger.info("Wait 10 seconds for ms to be restarted");
273271
Thread.sleep(10);
@@ -278,7 +276,7 @@ public void testOPRestartDeadMS() throws Exception {
278276
logger.info("SUCCESS - " + testMethodName);
279277
}
280278

281-
private void scaleDownAndVarify(int decrNum) throws Exception {
279+
private void scaleDownAndverify(int decrNum) throws Exception {
282280
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
283281
logTestBegin(testMethodName);
284282

@@ -308,7 +306,7 @@ private void scaleDownAndVarify(int decrNum) throws Exception {
308306
}
309307
}
310308

311-
private void scaleUpAndVarify(int incrNum) throws Exception {
309+
private void scaleUpAndverify(int incrNum) throws Exception {
312310
Map<String, Object> domainMap = domain.getDomainMap();
313311
String domainUid = domain.getDomainUid();
314312
String domainNS = domainMap.get("namespace").toString();
@@ -322,10 +320,10 @@ private void scaleUpAndVarify(int incrNum) throws Exception {
322320
logger.info("Scale domain " + domainUid + " up to " + replicas + " managed servers");
323321
operator.scale(domainUid, clusterName, replicas);
324322

325-
varifyPodReady(replicas);
323+
verifyPodReady(replicas);
326324
}
327325

328-
private void varifyPodReady(int replicas) throws Exception {
326+
private void verifyPodReady(int replicas) throws Exception {
329327
Map<String, Object> domainMap = domain.getDomainMap();
330328
String domainUid = domain.getDomainUid();
331329
String domainNS = domainMap.get("namespace").toString();

0 commit comments

Comments
 (0)