@@ -32,7 +32,7 @@ var _ = Describe("LightrunJavaAgent controller", func() {
3232 agentPlatform = "linux"
3333 initVolumeName = "lightrun-agent-init"
3434 javaEnv = "JAVA_TOOL_OPTIONS"
35- defaultAgentPath = " -agentpath:/lightrun/agent/lightrun_agent.so"
35+ defaultAgentPath = "-agentpath:/lightrun/agent/lightrun_agent.so"
3636 agentCliFlags = "--lightrun_extra_class_path=<PATH_TO_JAR>"
3737 javaEnvNonEmptyValue = "-Djava.net.preferIPv4Stack=true"
3838 )
@@ -264,7 +264,7 @@ var _ = Describe("LightrunJavaAgent controller", func() {
264264 return false
265265 }
266266 } else if container .Name == "app2" {
267- if envVar .Value != javaEnvNonEmptyValue + defaultAgentPath + "=" + agentCliFlags {
267+ if envVar .Value != javaEnvNonEmptyValue + " " + defaultAgentPath + "=" + agentCliFlags {
268268 return false
269269 }
270270 }
@@ -344,12 +344,12 @@ var _ = Describe("LightrunJavaAgent controller", func() {
344344 Eventually (func () bool {
345345 flag := 0
346346 for k , v := range patchedDepl .ObjectMeta .Annotations {
347- if k == "lightrun.com/lightrunjavaagent" && v == lragent1Name {
347+ if k == annotationAgentName && v == lragent1Name {
348348 flag += 1
349349 }
350350 }
351351 for k := range patchedDepl .Spec .Template .Annotations {
352- if k == "lightrun.com/configmap-hash" {
352+ if k == annotationConfigMapHash {
353353 flag += 1
354354 }
355355 }
@@ -358,7 +358,7 @@ var _ = Describe("LightrunJavaAgent controller", func() {
358358 })
359359 It ("Should not change hash of the configmap in the deployment metadata" , func () {
360360 Eventually (func () bool {
361- return patchedDepl .Spec .Template .Annotations ["lightrun.com/configmap-hash" ] == fmt .Sprint (hash (cm .Data ["config" ]+ cm .Data ["metadata" ]))
361+ return patchedDepl .Spec .Template .Annotations [annotationConfigMapHash ] == fmt .Sprint (hash (cm .Data ["config" ]+ cm .Data ["metadata" ]))
362362 }).Should (BeTrue ())
363363 })
364364
@@ -461,12 +461,12 @@ var _ = Describe("LightrunJavaAgent controller", func() {
461461 It ("Should delete annotations from deployment" , func () {
462462 Eventually (func () bool {
463463 for k := range patchedDepl .ObjectMeta .Annotations {
464- if k == "lightrun.com/lightrunjavaagent" {
464+ if k == annotationAgentName {
465465 return false
466466 }
467467 }
468468 for k := range patchedDepl .Spec .Template .Annotations {
469- if k == "lightrun.com/configmap-hash" {
469+ if k == annotationConfigMapHash {
470470 return false
471471 }
472472 }
@@ -561,7 +561,7 @@ var _ = Describe("LightrunJavaAgent controller", func() {
561561 return false
562562 }
563563 } else if container .Name == "app2" {
564- if envVar .Value != javaEnvNonEmptyValue + defaultAgentPath {
564+ if envVar .Value != javaEnvNonEmptyValue + " " + defaultAgentPath {
565565 return false
566566 }
567567 }
@@ -695,7 +695,7 @@ var _ = Describe("LightrunJavaAgent controller", func() {
695695 if err := k8sClient .Get (ctx , deplRequest2 , & patchedDepl2 ); err != nil {
696696 return false
697697 }
698- return patchedDepl2 .Annotations ["lightrun.com/lightrunjavaagent" ] == lrAgent2 .Name
698+ return patchedDepl2 .Annotations [annotationAgentName ] == lrAgent2 .Name
699699 }).Should (BeTrue ())
700700 })
701701
@@ -782,7 +782,7 @@ var _ = Describe("LightrunJavaAgent controller", func() {
782782 if err := k8sClient .Get (ctx , deplRequest3 , & patchedDepl3 ); err != nil {
783783 return false
784784 }
785- if _ , ok := patchedDepl3 .Annotations ["lightrun.com/lightrunjavaagent" ]; ! ok && len (patchedDepl3 .Finalizers ) == 0 {
785+ if _ , ok := patchedDepl3 .Annotations [annotationAgentName ]; ! ok && len (patchedDepl3 .Finalizers ) == 0 {
786786 return true
787787 }
788788 return false
@@ -871,7 +871,7 @@ var _ = Describe("LightrunJavaAgent controller", func() {
871871 return false
872872 }
873873 } else if container .Name == "app2" {
874- if envVar .Value != javaEnvNonEmptyValue + defaultAgentPath {
874+ if envVar .Value != javaEnvNonEmptyValue + " " + defaultAgentPath {
875875 return false
876876 }
877877 }
@@ -886,16 +886,16 @@ var _ = Describe("LightrunJavaAgent controller", func() {
886886 if err := k8sClient .Get (ctx , lrAgentRequest5 , & lrAgent5 ); err != nil {
887887 return false
888888 }
889- if patchedDepl4 .Annotations ["lightrun.com/lightrunjavaagent" ] != lrAgent5 .Name {
890- // logger.Info("annotations", "lightrun.com/lightrunjavaagent ", patchedDepl4.Annotations["lightrun.com/lightrunjavaagent "])
889+ if patchedDepl4 .Annotations [annotationAgentName ] != lrAgent5 .Name {
890+ // logger.Info("annotations", "annotationAgentName ", patchedDepl4.Annotations["annotationAgentName "])
891891 return false
892892 }
893- if patchedDepl4 .Annotations ["lightrun.com/patched-env-name" ] != javaEnv {
894- // logger.Info("annotations", "lightrun.com/patched-env-name" , patchedDepl4.Annotations["lightrun.com/patched-env-name" ])
893+ if patchedDepl4 .Annotations [annotationPatchedEnvName ] != javaEnv {
894+ // logger.Info("annotations", annotationPatchedEnvName , patchedDepl4.Annotations[annotationPatchedEnvName ])
895895 return false
896896 }
897- if patchedDepl4 .Annotations ["lightrun.com/patched-env-value" ] != defaultAgentPath {
898- // logger.Info("annotations", "lightrun.com/patched-env-value" , patchedDepl4.Annotations["lightrun.com/patched-env-value" ])
897+ if patchedDepl4 .Annotations [annotationPatchedEnvValue ] != defaultAgentPath {
898+ // logger.Info("annotations", annotationPatchedEnvValue , patchedDepl4.Annotations[annotationPatchedEnvValue ])
899899 return false
900900 }
901901 return true
@@ -938,10 +938,10 @@ var _ = Describe("LightrunJavaAgent controller", func() {
938938 }
939939 }
940940 }
941- if patchedDepl4 .Annotations ["lightrun.com/patched-env-name" ] != "NEW_ENV_NAME" {
941+ if patchedDepl4 .Annotations [annotationPatchedEnvName ] != "NEW_ENV_NAME" {
942942 return false
943943 }
944- if patchedDepl4 .Annotations ["lightrun.com/patched-env-value" ] != defaultAgentPath {
944+ if patchedDepl4 .Annotations [annotationPatchedEnvValue ] != defaultAgentPath {
945945 return false
946946 }
947947 return true
@@ -965,8 +965,8 @@ var _ = Describe("LightrunJavaAgent controller", func() {
965965 if err := k8sClient .Get (ctx , deplRequest4 , & patchedDepl4 ); err != nil {
966966 return false
967967 }
968- if patchedDepl4 .Annotations ["lightrun.com/patched-env-value" ] != defaultAgentPath + "=--new-flags" {
969- logger .Info ("annotations" , "lightrun.com/patched-env-value" , patchedDepl4 .Annotations ["lightrun.com/patched-env-value" ])
968+ if patchedDepl4 .Annotations [annotationPatchedEnvValue ] != defaultAgentPath + "=--new-flags" {
969+ logger .Info ("annotations" , annotationPatchedEnvValue , patchedDepl4 .Annotations [annotationPatchedEnvValue ])
970970 return false
971971 }
972972 for _ , container := range patchedDepl4 .Spec .Template .Spec .Containers {
0 commit comments