JWTEmitter now runs among tests when tests are running
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
a20ba55248
commit
fdfc3cbac1
@ -1,8 +1,35 @@
|
||||
package org.tbasket.test
|
||||
|
||||
|
||||
import com.sun.nio.file.ExtendedOpenOption
|
||||
import io.netty.buffer.ByteBuf
|
||||
|
||||
import java.nio.channels.Pipe
|
||||
import java.nio.file.{Files, Path, StandardOpenOption}
|
||||
|
||||
object TestEmitter:
|
||||
val PORT = 5455
|
||||
val PORT = 5457
|
||||
|
||||
|
||||
def start(): Unit = {
|
||||
val emitterPresence = Path.of("/tmp/emitter.presence")
|
||||
Files.deleteIfExists(emitterPresence)
|
||||
|
||||
val process = new ProcessBuilder(
|
||||
"bash",
|
||||
"./mill", "JWTEmitter.run",
|
||||
"-k", "/tmp/keys/key.pcqks",
|
||||
"-p", TestServerConfig.emitterURL.port.get.toString
|
||||
)
|
||||
.inheritIO()
|
||||
.start()
|
||||
Runtime.getRuntime.addShutdownHook(new Thread((() => process.destroy()): Runnable))
|
||||
|
||||
//the emitter will create the /tmp/emitter.presence file once it started, this is to inform us that the server is OP
|
||||
while (Files.notExists(emitterPresence))
|
||||
Thread.sleep(500)
|
||||
|
||||
if (Files.readString(emitterPresence) == "A") {
|
||||
System.err.println("Emitter did not start successfully")
|
||||
System.exit(1)
|
||||
}
|
||||
Files.delete(emitterPresence)
|
||||
}
|
||||
|
Reference in new issue