From 88bebf9d4de5f23344597e6b1137ec677d30bd7c Mon Sep 17 00:00:00 2001
From: lorenz <stu203404@mail.uni-kiel.de>
Date: Tue, 23 Mar 2021 19:46:29 +0100
Subject: [PATCH] Changed path KubernetesBenchmark.kt + native.image.build.args
 + fix build scripts

---
 theodolite-quarkus/build_jvm.sh                             | 3 +--
 theodolite-quarkus/build_native.sh                          | 3 +--
 theodolite-quarkus/src/main/docker/Dockerfile.jvm           | 1 +
 .../main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt | 5 +++--
 .../kotlin/theodolite/execution/TheodoliteYamlExecutor.kt   | 6 ++++--
 .../src/main/resources/application.properties               | 4 +++-
 6 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/theodolite-quarkus/build_jvm.sh b/theodolite-quarkus/build_jvm.sh
index f3970d08e..95e2e4442 100755
--- a/theodolite-quarkus/build_jvm.sh
+++ b/theodolite-quarkus/build_jvm.sh
@@ -1,7 +1,6 @@
 
-./gradlew build
+./gradlew build -x test
 
 docker build -f src/main/docker/Dockerfile.jvm -t quarkus/theodolite-quarkus-jvm .
 
-
 docker run -i --rm -p 8080:8080 quarkus/theodolite-quarkus-jvm
diff --git a/theodolite-quarkus/build_native.sh b/theodolite-quarkus/build_native.sh
index 8b663f6ed..1effa3268 100755
--- a/theodolite-quarkus/build_native.sh
+++ b/theodolite-quarkus/build_native.sh
@@ -1,6 +1,5 @@
 
-./gradlew build -Dquarkus.package.type=native
-
+./gradlew build -Dquarkus.package.type=native -x test
 
 docker build -f src/main/docker/Dockerfile.native -t quarkus/theodolite-quarkus .
 
diff --git a/theodolite-quarkus/src/main/docker/Dockerfile.jvm b/theodolite-quarkus/src/main/docker/Dockerfile.jvm
index d6a4e05cd..6733d5d44 100644
--- a/theodolite-quarkus/src/main/docker/Dockerfile.jvm
+++ b/theodolite-quarkus/src/main/docker/Dockerfile.jvm
@@ -44,6 +44,7 @@ RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \
 ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
 COPY build/lib/* /deployments/lib/
 COPY build/*-runner.jar /deployments/app.jar
+COPY config/ /deployments/config/
 
 EXPOSE 8080
 USER 1001
diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt
index 62b7ba8eb..b4c9919b8 100644
--- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt
+++ b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/KubernetesBenchmark.kt
@@ -21,9 +21,10 @@ class KubernetesBenchmark : Benchmark {
     lateinit var loadTypes: List<TypeName>
     lateinit var kafkaConfig: KafkaConfig
     lateinit var namespace: String
+    lateinit var path: String
 
     private fun loadKubernetesResources(resources: List<String>): List<Pair<String, KubernetesResource>> {
-        val basePath = "./../../../resources/main/yaml/"
+        //val path = "./../../../resources/main/yaml/"
         val parser = YamlParser()
 
         namespace = System.getenv("NAMESPACE") ?: DEFAULT_NAMESPACE
@@ -32,7 +33,7 @@ class KubernetesBenchmark : Benchmark {
         val loader = K8sResourceLoader(DefaultKubernetesClient().inNamespace(namespace))
         return resources
             .map { resource ->
-                val resourcePath = "$basePath/$resource"
+                val resourcePath = "$path/$resource"
                 val kind = parser.parse(resourcePath, HashMap<String, String>()::class.java)?.get("kind")!!
                 val k8sResource = loader.loadK8sResource(kind, resourcePath)
                 Pair(resource, k8sResource)
diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteYamlExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteYamlExecutor.kt
index d6505431c..66d8b1d9b 100644
--- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteYamlExecutor.kt
+++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteYamlExecutor.kt
@@ -16,7 +16,7 @@ object TheodoliteYamlExecutor {
     fun main(args: Array<String>) {
         logger.info { "Theodolite started" }
         val path = Paths.get("").toAbsolutePath().toString()
-        logger.info{ path }
+        logger.info { path }
 
         // load the BenchmarkExecution and the BenchmarkType
         val parser = YamlParser()
@@ -25,7 +25,9 @@ object TheodoliteYamlExecutor {
         val benchmark =
             parser.parse("./config/BenchmarkType.yaml", KubernetesBenchmark::class.java)!!
 
-        logger.info { benchmark.name.toString() }
+        //logger.info { benchmark.name.toString() }
+
+        benchmark.path = "config/"
 
         val executor = TheodoliteExecutor(benchmarkExecution, benchmark)
         executor.run()
diff --git a/theodolite-quarkus/src/main/resources/application.properties b/theodolite-quarkus/src/main/resources/application.properties
index e46818b79..318ce68ff 100644
--- a/theodolite-quarkus/src/main/resources/application.properties
+++ b/theodolite-quarkus/src/main/resources/application.properties
@@ -1,2 +1,4 @@
 quarkus.package.main-class=TheodoliteYamlExecutor
-quarkus.native.additional-build-args=--initialize-at-run-time=io.fabric8.kubernetes.client.internal.CertUtils
\ No newline at end of file
+quarkus.native.additional-build-args=\
+  --initialize-at-run-time=io.fabric8.kubernetes.client.internal.CertUtils,\
+  --report-unsupported-elements-at-runtime
\ No newline at end of file
-- 
GitLab