Skip to content
This repository was archived by the owner on May 25, 2023. It is now read-only.

Commit d6e1ef6

Browse files
committed
increase timeout for pod spinup
1 parent 8a08c82 commit d6e1ef6

File tree

4 files changed

+32
-31
lines changed

4 files changed

+32
-31
lines changed

integrateion-test/src/sbt-test/bootstrap-demo/dns-kubernetes/build.sbt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ lazy val root = (project in file("."))
6767
s.log.info("applying openshift.yml")
6868
Process(s"$kubectl apply -f kubernetes/openshift.yml").!(s.log)
6969

70-
waitForPods(3, 10, s.log)
70+
waitForPods(3, 20, s.log)
7171
val p = findPodId(nm, s.log)
7272
checkMemberUp(p, 10, s.log)
7373
}
@@ -86,22 +86,13 @@ lazy val root = (project in file("."))
8686

8787
def waitForPods(expected: Int, attempt: Int, log: Logger): Unit = {
8888
if (attempt == 0) {
89-
val lines = try {
90-
Process(s"$kubectl describe pods --namespace reactivelibtest1").!!.lines.toList
91-
} catch {
92-
case NonFatal(_) => Nil
93-
}
94-
lines foreach { log.info(_: String) }
89+
processAndLog(s"$kubectl describe pods --namespace reactivelibtest1")
9590
sys.error("pods did not get ready in time")
9691
}
9792
else {
9893
log.info("waiting for pods to get ready...")
99-
val lines = try {
100-
Process(s"$kubectl get pods --namespace reactivelibtest1").!!.lines.toList
101-
} catch {
102-
case NonFatal(_) => Nil
103-
}
104-
lines foreach { log.info(_: String) }
94+
val lines = processAndLog(s"$kubectl get pods --namespace reactivelibtest1")
95+
processAndLog(s"$kubectl describe pods --namespace reactivelibtest1")
10596
if ((lines filter { _.contains("Running") }).size == expected) ()
10697
else {
10798
Thread.sleep(4000)
@@ -111,15 +102,24 @@ def waitForPods(expected: Int, attempt: Int, log: Logger): Unit = {
111102
}
112103

113104
def findPodId(nm: String, log: Logger): String = {
114-
val lines = Process(s"$kubectl get pods --namespace reactivelibtest1").!!.lines.toList
115-
lines foreach { log.info(_: String) }
105+
val lines = processAndLog(s"$kubectl get pods --namespace reactivelibtest1")
116106
val xs = lines filter { s => s.contains("Running") && s.contains(nm) }
117107
val firstRow = xs.headOption.getOrElse(sys.error("pods not found!"))
118108
val firstColumn = firstRow.trim.split(" ").toList
119109
.headOption.getOrElse(sys.error("pods not found!"))
120110
firstColumn
121111
}
122112

113+
def processAndLog(cmd: String, log: Logger): List[String] = {
114+
val lines = try {
115+
Process(cmd).!!.lines.toList
116+
} catch {
117+
case NonFatal(_) => Nil
118+
}
119+
lines foreach { log.info(_: String) }
120+
lines
121+
}
122+
123123
def checkMemberUp(p: String, attempt: Int, log: Logger): Unit = {
124124
if (attempt == 0) sys.error("3 MemberUp log events were not found")
125125
else {

integrateion-test/src/sbt-test/bootstrap-demo/dns-kubernetes/src/main/scala/foo/ClusterApp.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ object ClusterApp {
2525

2626
val cluster = Cluster(system)
2727
system.log.info("Starting Akka Management")
28+
system.log.info("something")
2829
// AkkaManagement(system).start()
2930
// ClusterBootstrap(system).start()
3031

integrateion-test/src/sbt-test/bootstrap-demo/kubernetes-api/build.sbt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ lazy val root = (project in file("."))
7474
s.log.info("applying openshift.yml")
7575
Process(s"$kubectl apply -f kubernetes/openshift.yml").!(s.log)
7676

77-
waitForPods(3, 10, s.log)
77+
waitForPods(3, 20, s.log)
7878
val p = findPodId(nm, s.log)
7979
checkMemberUp(p, 10, s.log)
8080
}
@@ -93,21 +93,12 @@ def kubectl: String = {
9393

9494
def waitForPods(expected: Int, attempt: Int, log: Logger): Unit = {
9595
if (attempt == 0) {
96-
val lines = try {
97-
Process(s"$kubectl describe pods --namespace reactivelibtest1").!!.lines.toList
98-
} catch {
99-
case NonFatal(_) => Nil
100-
}
101-
lines foreach { log.info(_: String) }
96+
processAndLog(s"$kubectl describe pods --namespace reactivelibtest1")
10297
sys.error("pods did not get ready in time")
10398
} else {
10499
log.info("waiting for pods to get ready...")
105-
val lines = try {
106-
Process(s"$kubectl get pods --namespace reactivelibtest1").!!.lines.toList
107-
} catch {
108-
case NonFatal(_) => Nil
109-
}
110-
lines foreach { log.info(_: String) }
100+
val lines = processAndLog(s"$kubectl get pods --namespace reactivelibtest1")
101+
processAndLog(s"$kubectl describe pods --namespace reactivelibtest1")
111102
if ((lines filter { _.contains("Running") }).size == expected) ()
112103
else {
113104
Thread.sleep(4000)
@@ -117,15 +108,24 @@ def waitForPods(expected: Int, attempt: Int, log: Logger): Unit = {
117108
}
118109

119110
def findPodId(nm: String, log: Logger): String = {
120-
val lines = Process(s"$kubectl get pods --namespace reactivelibtest1").!!.lines.toList
121-
lines foreach { log.info(_: String) }
111+
val lines = processAndLog(s"$kubectl get pods --namespace reactivelibtest1")
122112
val xs = lines filter { s => s.contains("Running") && s.contains(nm) }
123113
val firstRow = xs.headOption.getOrElse(sys.error("pods not found!"))
124114
val firstColumn = firstRow.trim.split(" ").toList
125115
.headOption.getOrElse(sys.error("pods not found!"))
126116
firstColumn
127117
}
128118

119+
def processAndLog(cmd: String, log: Logger): List[String] = {
120+
val lines = try {
121+
Process(cmd).!!.lines.toList
122+
} catch {
123+
case NonFatal(_) => Nil
124+
}
125+
lines foreach { log.info(_: String) }
126+
lines
127+
}
128+
129129
def checkMemberUp(p: String, attempt: Int, log: Logger): Unit = {
130130
if (attempt == 0) sys.error("3 MemberUp log events were not found")
131131
else {

integrateion-test/src/sbt-test/bootstrap-demo/kubernetes-api/src/main/scala/foo/DemoApp.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ object DemoApp extends App {
2323
val cluster = Cluster(system)
2424

2525
log.info(s"Started [$system], cluster.selfAddress = ${cluster.selfAddress}")
26-
26+
log.info("something")
2727
//#start-akka-management
2828
AkkaManagement(system).start()
2929
//#start-akka-management

0 commit comments

Comments
 (0)