@@ -32,7 +32,7 @@ var _ = Describe("LightrunJavaAgent controller", func() {
32
32
agentPlatform = "linux"
33
33
initVolumeName = "lightrun-agent-init"
34
34
javaEnv = "JAVA_TOOL_OPTIONS"
35
- defaultAgentPath = " -agentpath:/lightrun/agent/lightrun_agent.so"
35
+ defaultAgentPath = "-agentpath:/lightrun/agent/lightrun_agent.so"
36
36
agentCliFlags = "--lightrun_extra_class_path=<PATH_TO_JAR>"
37
37
javaEnvNonEmptyValue = "-Djava.net.preferIPv4Stack=true"
38
38
)
@@ -264,7 +264,7 @@ var _ = Describe("LightrunJavaAgent controller", func() {
264
264
return false
265
265
}
266
266
} else if container .Name == "app2" {
267
- if envVar .Value != javaEnvNonEmptyValue + defaultAgentPath + "=" + agentCliFlags {
267
+ if envVar .Value != javaEnvNonEmptyValue + " " + defaultAgentPath + "=" + agentCliFlags {
268
268
return false
269
269
}
270
270
}
@@ -344,12 +344,12 @@ var _ = Describe("LightrunJavaAgent controller", func() {
344
344
Eventually (func () bool {
345
345
flag := 0
346
346
for k , v := range patchedDepl .ObjectMeta .Annotations {
347
- if k == "lightrun.com/lightrunjavaagent" && v == lragent1Name {
347
+ if k == annotationAgentName && v == lragent1Name {
348
348
flag += 1
349
349
}
350
350
}
351
351
for k := range patchedDepl .Spec .Template .Annotations {
352
- if k == "lightrun.com/configmap-hash" {
352
+ if k == annotationConfigMapHash {
353
353
flag += 1
354
354
}
355
355
}
@@ -358,7 +358,7 @@ var _ = Describe("LightrunJavaAgent controller", func() {
358
358
})
359
359
It ("Should not change hash of the configmap in the deployment metadata" , func () {
360
360
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" ]))
362
362
}).Should (BeTrue ())
363
363
})
364
364
@@ -461,12 +461,12 @@ var _ = Describe("LightrunJavaAgent controller", func() {
461
461
It ("Should delete annotations from deployment" , func () {
462
462
Eventually (func () bool {
463
463
for k := range patchedDepl .ObjectMeta .Annotations {
464
- if k == "lightrun.com/lightrunjavaagent" {
464
+ if k == annotationAgentName {
465
465
return false
466
466
}
467
467
}
468
468
for k := range patchedDepl .Spec .Template .Annotations {
469
- if k == "lightrun.com/configmap-hash" {
469
+ if k == annotationConfigMapHash {
470
470
return false
471
471
}
472
472
}
@@ -561,7 +561,7 @@ var _ = Describe("LightrunJavaAgent controller", func() {
561
561
return false
562
562
}
563
563
} else if container .Name == "app2" {
564
- if envVar .Value != javaEnvNonEmptyValue + defaultAgentPath {
564
+ if envVar .Value != javaEnvNonEmptyValue + " " + defaultAgentPath {
565
565
return false
566
566
}
567
567
}
@@ -695,7 +695,7 @@ var _ = Describe("LightrunJavaAgent controller", func() {
695
695
if err := k8sClient .Get (ctx , deplRequest2 , & patchedDepl2 ); err != nil {
696
696
return false
697
697
}
698
- return patchedDepl2 .Annotations ["lightrun.com/lightrunjavaagent" ] == lrAgent2 .Name
698
+ return patchedDepl2 .Annotations [annotationAgentName ] == lrAgent2 .Name
699
699
}).Should (BeTrue ())
700
700
})
701
701
@@ -782,7 +782,7 @@ var _ = Describe("LightrunJavaAgent controller", func() {
782
782
if err := k8sClient .Get (ctx , deplRequest3 , & patchedDepl3 ); err != nil {
783
783
return false
784
784
}
785
- if _ , ok := patchedDepl3 .Annotations ["lightrun.com/lightrunjavaagent" ]; ! ok && len (patchedDepl3 .Finalizers ) == 0 {
785
+ if _ , ok := patchedDepl3 .Annotations [annotationAgentName ]; ! ok && len (patchedDepl3 .Finalizers ) == 0 {
786
786
return true
787
787
}
788
788
return false
@@ -871,7 +871,7 @@ var _ = Describe("LightrunJavaAgent controller", func() {
871
871
return false
872
872
}
873
873
} else if container .Name == "app2" {
874
- if envVar .Value != javaEnvNonEmptyValue + defaultAgentPath {
874
+ if envVar .Value != javaEnvNonEmptyValue + " " + defaultAgentPath {
875
875
return false
876
876
}
877
877
}
@@ -886,16 +886,16 @@ var _ = Describe("LightrunJavaAgent controller", func() {
886
886
if err := k8sClient .Get (ctx , lrAgentRequest5 , & lrAgent5 ); err != nil {
887
887
return false
888
888
}
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 "])
891
891
return false
892
892
}
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 ])
895
895
return false
896
896
}
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 ])
899
899
return false
900
900
}
901
901
return true
@@ -938,10 +938,10 @@ var _ = Describe("LightrunJavaAgent controller", func() {
938
938
}
939
939
}
940
940
}
941
- if patchedDepl4 .Annotations ["lightrun.com/patched-env-name" ] != "NEW_ENV_NAME" {
941
+ if patchedDepl4 .Annotations [annotationPatchedEnvName ] != "NEW_ENV_NAME" {
942
942
return false
943
943
}
944
- if patchedDepl4 .Annotations ["lightrun.com/patched-env-value" ] != defaultAgentPath {
944
+ if patchedDepl4 .Annotations [annotationPatchedEnvValue ] != defaultAgentPath {
945
945
return false
946
946
}
947
947
return true
@@ -965,8 +965,8 @@ var _ = Describe("LightrunJavaAgent controller", func() {
965
965
if err := k8sClient .Get (ctx , deplRequest4 , & patchedDepl4 ); err != nil {
966
966
return false
967
967
}
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 ])
970
970
return false
971
971
}
972
972
for _ , container := range patchedDepl4 .Spec .Template .Spec .Containers {
0 commit comments