@@ -76,7 +76,69 @@ func TestInjectJavaagent(t *testing.T) {
76
76
Env : []corev1.EnvVar {
77
77
{
78
78
Name : "JAVA_TOOL_OPTIONS" ,
79
- Value : javaJVMArgument ,
79
+ Value : javaAgent ,
80
+ },
81
+ },
82
+ },
83
+ },
84
+ },
85
+ },
86
+ err : nil ,
87
+ },
88
+ {
89
+ name : "add extensions to JAVA_TOOL_OPTIONS" ,
90
+ Java : v1alpha1.Java {Image : "foo/bar:1" , Extensions : & v1alpha1.Extensions {Image : "ex/ex:1" , Dir : "/ex" }},
91
+ pod : corev1.Pod {
92
+ Spec : corev1.PodSpec {
93
+ Containers : []corev1.Container {
94
+ {},
95
+ },
96
+ },
97
+ },
98
+ expected : corev1.Pod {
99
+ Spec : corev1.PodSpec {
100
+ Volumes : []corev1.Volume {
101
+ {
102
+ Name : "opentelemetry-auto-instrumentation-java" ,
103
+ VolumeSource : corev1.VolumeSource {
104
+ EmptyDir : & corev1.EmptyDirVolumeSource {
105
+ SizeLimit : & defaultVolumeLimitSize ,
106
+ },
107
+ },
108
+ },
109
+ },
110
+ InitContainers : []corev1.Container {
111
+ {
112
+ Name : "opentelemetry-auto-instrumentation-java" ,
113
+ Image : "foo/bar:1" ,
114
+ Command : []string {"cp" , "/javaagent.jar" , "/otel-auto-instrumentation-java/javaagent.jar" },
115
+ VolumeMounts : []corev1.VolumeMount {{
116
+ Name : "opentelemetry-auto-instrumentation-java" ,
117
+ MountPath : "/otel-auto-instrumentation-java" ,
118
+ }},
119
+ },
120
+ {
121
+ Name : "opentelemetry-auto-instrumentation-extensions" ,
122
+ Image : "ex/ex:1" ,
123
+ Command : []string {"cp" , "-r" , "/ex" , "/otel-auto-instrumentation-java/extensions" },
124
+ VolumeMounts : []corev1.VolumeMount {{
125
+ Name : "opentelemetry-auto-instrumentation-java" ,
126
+ MountPath : "/otel-auto-instrumentation-java" ,
127
+ }},
128
+ },
129
+ },
130
+ Containers : []corev1.Container {
131
+ {
132
+ VolumeMounts : []corev1.VolumeMount {
133
+ {
134
+ Name : "opentelemetry-auto-instrumentation-java" ,
135
+ MountPath : "/otel-auto-instrumentation-java" ,
136
+ },
137
+ },
138
+ Env : []corev1.EnvVar {
139
+ {
140
+ Name : "JAVA_TOOL_OPTIONS" ,
141
+ Value : javaAgent + " -Dotel.javaagent.extensions=/otel-auto-instrumentation-java/extensions" ,
80
142
},
81
143
},
82
144
},
@@ -137,7 +199,7 @@ func TestInjectJavaagent(t *testing.T) {
137
199
Env : []corev1.EnvVar {
138
200
{
139
201
Name : "JAVA_TOOL_OPTIONS" ,
140
- Value : "-Dbaz=bar" + javaJVMArgument ,
202
+ Value : "-Dbaz=bar" + javaAgent ,
141
203
},
142
204
},
143
205
},
0 commit comments