Skip to content

Commit f3a3707

Browse files
committed
Please unit tests
1 parent 1573b3e commit f3a3707

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

pkg/instrumentation/podmutator_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,7 +1326,7 @@ func TestMutatePod(t *testing.T) {
13261326
{
13271327
Name: pythonInitContainerName,
13281328
Image: "otel/python:1",
1329-
Command: []string{"cp", "-r", "/autoinstrumentation/.", pythonInstrMountPath},
1329+
Command: []string{"test", "-d", "/autoinstrumentation/.", "&&", "cp", "-r", "/autoinstrumentation/.", pythonInstrMountPath, "||", "cp", "-r", "/autoinstrumentation/.", pythonInstrMountPath},
13301330
VolumeMounts: []corev1.VolumeMount{{
13311331
Name: pythonVolumeName,
13321332
MountPath: pythonInstrMountPath,
@@ -1535,7 +1535,7 @@ func TestMutatePod(t *testing.T) {
15351535
{
15361536
Name: pythonInitContainerName,
15371537
Image: "otel/python:1",
1538-
Command: []string{"cp", "-r", "/autoinstrumentation/.", pythonInstrMountPath},
1538+
Command: []string{"test", "-d", "/autoinstrumentation/.", "&&", "cp", "-r", "/autoinstrumentation/.", pythonInstrMountPath, "||", "cp", "-r", "/autoinstrumentation/.", pythonInstrMountPath},
15391539
VolumeMounts: []corev1.VolumeMount{{
15401540
Name: pythonVolumeName,
15411541
MountPath: pythonInstrMountPath,
@@ -3667,7 +3667,7 @@ func TestMutatePod(t *testing.T) {
36673667
{
36683668
Name: pythonInitContainerName,
36693669
Image: "otel/python:1",
3670-
Command: []string{"cp", "-r", "/autoinstrumentation/.", pythonInstrMountPath},
3670+
Command: []string{"test", "-d", "/autoinstrumentation/.", "&&", "cp", "-r", "/autoinstrumentation/.", pythonInstrMountPath, "||", "cp", "-r", "/autoinstrumentation/.", pythonInstrMountPath},
36713671
VolumeMounts: []corev1.VolumeMount{{
36723672
Name: pythonVolumeName,
36733673
MountPath: pythonInstrMountPath,

pkg/instrumentation/python_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func TestInjectPythonSDK(t *testing.T) {
6060
{
6161
Name: "opentelemetry-auto-instrumentation-python",
6262
Image: "foo/bar:1",
63-
Command: []string{"cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-python"},
63+
Command: []string{"test", "-d", "/autoinstrumentation/.", "&&", "cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-python", "||", "cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-python"},
6464
VolumeMounts: []corev1.VolumeMount{{
6565
Name: "opentelemetry-auto-instrumentation-python",
6666
MountPath: "/otel-auto-instrumentation-python",
@@ -137,7 +137,7 @@ func TestInjectPythonSDK(t *testing.T) {
137137
{
138138
Name: "opentelemetry-auto-instrumentation-python",
139139
Image: "foo/bar:1",
140-
Command: []string{"cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-python"},
140+
Command: []string{"test", "-d", "/autoinstrumentation/.", "&&", "cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-python", "||", "cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-python"},
141141
VolumeMounts: []corev1.VolumeMount{{
142142
Name: "opentelemetry-auto-instrumentation-python",
143143
MountPath: "/otel-auto-instrumentation-python",
@@ -215,7 +215,7 @@ func TestInjectPythonSDK(t *testing.T) {
215215
{
216216
Name: "opentelemetry-auto-instrumentation-python",
217217
Image: "foo/bar:1",
218-
Command: []string{"cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-python"},
218+
Command: []string{"test", "-d", "/autoinstrumentation/.", "&&", "cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-python", "||", "cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-python"},
219219
VolumeMounts: []corev1.VolumeMount{{
220220
Name: "opentelemetry-auto-instrumentation-python",
221221
MountPath: "/otel-auto-instrumentation-python",
@@ -292,7 +292,7 @@ func TestInjectPythonSDK(t *testing.T) {
292292
{
293293
Name: "opentelemetry-auto-instrumentation-python",
294294
Image: "foo/bar:1",
295-
Command: []string{"cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-python"},
295+
Command: []string{"test", "-d", "/autoinstrumentation/.", "&&", "cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-python", "||", "cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-python"},
296296
VolumeMounts: []corev1.VolumeMount{{
297297
Name: "opentelemetry-auto-instrumentation-python",
298298
MountPath: "/otel-auto-instrumentation-python",
@@ -445,7 +445,7 @@ func TestInjectPythonSDK(t *testing.T) {
445445
{
446446
Name: "opentelemetry-auto-instrumentation-python",
447447
Image: "foo/bar:1",
448-
Command: []string{"cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-python"},
448+
Command: []string{"test", "-d", "/autoinstrumentation/.", "&&", "cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-python", "||", "cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-python"},
449449
VolumeMounts: []corev1.VolumeMount{{
450450
Name: "opentelemetry-auto-instrumentation-python",
451451
MountPath: "/otel-auto-instrumentation-python",
@@ -549,7 +549,7 @@ func TestInjectPythonSDK(t *testing.T) {
549549
{
550550
Name: "opentelemetry-auto-instrumentation-python",
551551
Image: "foo/bar:1",
552-
Command: []string{"cp", "-r", "/autoinstrumentation-musl/.", "/otel-auto-instrumentation-python"},
552+
Command: []string{"test", "-d", "/autoinstrumentation-musl/.", "&&", "cp", "-r", "/autoinstrumentation-musl/.", "/otel-auto-instrumentation-python", "||", "cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-python"},
553553
VolumeMounts: []corev1.VolumeMount{{
554554
Name: "opentelemetry-auto-instrumentation-python",
555555
MountPath: "/otel-auto-instrumentation-python",
@@ -615,7 +615,7 @@ func TestInjectPythonSDK(t *testing.T) {
615615
{
616616
Name: "opentelemetry-auto-instrumentation-python",
617617
Image: "foo/bar:1",
618-
Command: []string{"cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-python"},
618+
Command: []string{"test", "-d", "/autoinstrumentation/.", "&&", "cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-python", "||", "cp", "-r", "/autoinstrumentation/.", "/otel-auto-instrumentation-python"},
619619
VolumeMounts: []corev1.VolumeMount{{
620620
Name: "opentelemetry-auto-instrumentation-python",
621621
MountPath: "/otel-auto-instrumentation-python",

pkg/instrumentation/sdk_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ func TestInjectPython(t *testing.T) {
12111211
{
12121212
Name: pythonInitContainerName,
12131213
Image: "img:1",
1214-
Command: []string{"cp", "-r", "/autoinstrumentation/.", pythonInstrMountPath},
1214+
Command: []string{"test", "-d", "/autoinstrumentation/.", "&&", "cp", "-r", "/autoinstrumentation/.", pythonInstrMountPath, "||", "cp", "-r", "/autoinstrumentation/.", pythonInstrMountPath},
12151215
VolumeMounts: []corev1.VolumeMount{{
12161216
Name: pythonVolumeName,
12171217
MountPath: pythonInstrMountPath,

0 commit comments

Comments
 (0)