diff --git a/cmd/otelcol/Dockerfile b/cmd/otelcol/Dockerfile index be8664c3fc..41072d1821 100644 --- a/cmd/otelcol/Dockerfile +++ b/cmd/otelcol/Dockerfile @@ -62,6 +62,9 @@ COPY --from=otelcol --chown=999 /otel/collector /etc/otel/collector COPY --from=agent-bundle --chown=999 /usr/lib/splunk-otel-collector /usr/lib/splunk-otel-collector COPY --from=jmx --chown=999 /tmp/opentelemetry-jmx-metrics.jar /opt/opentelemetry-java-contrib-jmx-metrics.jar +COPY --from=otelcol --chown=999 /tmp /tmp +ENV TMPDIR=/tmp + COPY --from=journalctl --chown=999 /bin/journalctl /bin/journalctl COPY --from=journalctl --chown=999 /opt/journalctl / diff --git a/tests/receivers/jmxreceiver/jmxreceiver_test.go b/tests/receivers/jmxreceiver/jmxreceiver_test.go index 6eae08eddb..a7c235ab88 100644 --- a/tests/receivers/jmxreceiver/jmxreceiver_test.go +++ b/tests/receivers/jmxreceiver/jmxreceiver_test.go @@ -17,13 +17,9 @@ package tests import ( - "os" "path" - "path/filepath" "testing" - "github.com/stretchr/testify/require" - "github.com/signalfx/splunk-otel-collector/tests/testutils" ) @@ -35,12 +31,12 @@ func TestJMXReceiverProvidesAllJVMMetrics(t *testing.T) { ).WithExposedPorts("7199:7199").WithName("jmx").WillWaitForPorts("7199"), } - tmp_dir := "/etc/otel/collector/tmp" - local_tmp := filepath.Join(".", "tmp") - mount_dir, err := filepath.Abs(local_tmp) - require.NoError(t, err) - os.MkdirAll(mount_dir, 1777) - defer os.RemoveAll(local_tmp) + //tmp_dir := "/etc/otel/collector/tmp" + //local_tmp := filepath.Join(".", "tmp") + //mount_dir, err := filepath.Abs(local_tmp) + //require.NoError(t, err) + //os.MkdirAll(mount_dir, 1777) + //defer os.RemoveAll(local_tmp) testutils.AssertAllMetricsReceived(t, "all.yaml", "all_metrics_config.yaml", containers, @@ -49,9 +45,7 @@ func TestJMXReceiverProvidesAllJVMMetrics(t *testing.T) { // JMX requires a local directory that can be written to, so we must mount a local dir // that the collector has write access to. - return collector.WithEnv(map[string]string{ - "TMPDIR": tmp_dir, - }).WithMount(mount_dir, tmp_dir).WillFail(true) + return collector.WillFail(true) }, }) }