Skip to content

Commit 44b68ba

Browse files
Use sh instead of bash for tests
1 parent 634b832 commit 44b68ba

File tree

7 files changed

+17
-17
lines changed

7 files changed

+17
-17
lines changed

.github/workflows/linux-package-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ jobs:
345345
docker exec otelcol /usr/lib/splunk-otel-collector/agent-bundle/bin/python --version
346346
docker exec otelcol /usr/lib/splunk-otel-collector/agent-bundle/jre/bin/java -version
347347
# ensure collectd-python plugins were installed
348-
docker exec otelcol bash -c 'test -d /usr/lib/splunk-otel-collector/agent-bundle/collectd-python/'
348+
docker exec otelcol sh -c 'test -d /usr/lib/splunk-otel-collector/agent-bundle/collectd-python/'
349349
if [[ "$(docker exec otelcol ls /usr/lib/splunk-otel-collector/agent-bundle/collectd-python/ | wc -l)" -eq 0 ]]; then
350350
echo "/usr/lib/splunk-otel-collector/agent-bundle/collectd-python/ is empty!" >&2
351351
exit 1

tests/general/discoverymode/configd_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func TestConfigDInitialAndEffectiveConfig(t *testing.T) {
186186
require.Equal(t, expectedEffective, cc.EffectiveConfig(t, 55554))
187187

188188
sc, stdout, stderr := cc.Container.AssertExec(
189-
tc, 15*time.Second, "bash", "-c",
189+
tc, 15*time.Second, "sh", "-c",
190190
"SPLUNK_DEBUG_CONFIG_SERVER=false /otelcol --config-dir /opt/config.d --configd --set processors.batch/from-config-file.send_batch_size=123456789 --dry-run 2>/dev/null",
191191
)
192192
require.Equal(t, `exporters:

tests/general/discoverymode/docker_observer_discovery_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ func TestDockerObserver(t *testing.T) {
246246
require.Equal(t, expectedEffective, cc.EffectiveConfig(t, 55554))
247247

248248
sc, stdout, stderr := cc.Container.AssertExec(t, 25*time.Second,
249-
"bash", "-c", `SPLUNK_DISCOVERY_LOG_LEVEL=error SPLUNK_DEBUG_CONFIG_SERVER=false \
249+
"sh", "-c", `SPLUNK_DISCOVERY_LOG_LEVEL=error SPLUNK_DEBUG_CONFIG_SERVER=false \
250250
SPLUNK_DISCOVERY_EXTENSIONS_k8s_observer_ENABLED=false \
251251
SPLUNK_DISCOVERY_EXTENSIONS_docker_observer_ENABLED=true \
252252
SPLUNK_DISCOVERY_EXTENSIONS_docker_observer_CONFIG_endpoint=\${DOCKER_DOMAIN_SOCKET} \

tests/general/discoverymode/host_observer_discovery_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func TestHostObserver(t *testing.T) {
9797
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
9898
sc, r, err := cc.Container.Exec(ctx, []string{
9999
// no config server to prevent port collisions
100-
"bash", "-c", "SPLUNK_DEBUG_CONFIG_SERVER=false /otelcol --configd --config-dir /opt/internal-prometheus-config.d &",
100+
"sh", "-c", "SPLUNK_DEBUG_CONFIG_SERVER=false /otelcol --configd --config-dir /opt/internal-prometheus-config.d &",
101101
})
102102
cancel()
103103
if r != nil {
@@ -114,7 +114,7 @@ func TestHostObserver(t *testing.T) {
114114

115115
// get the pid of the collector for endpoint ID verification
116116
sc, stdout, stderr := cc.Container.AssertExec(
117-
t, 5*time.Second, "bash", "-c", "ps -C otelcol | tail -n 1 | grep -oE '^\\s*[0-9]+'",
117+
t, 5*time.Second, "sh", "-c", "ps -C otelcol | tail -n 1 | grep -oE '^\\s*[0-9]+'",
118118
)
119119
promPid := strings.TrimSpace(stdout)
120120
require.Zero(t, sc, stderr)
@@ -271,7 +271,7 @@ func TestHostObserver(t *testing.T) {
271271
require.Equal(t, expectedEffective, cc.EffectiveConfig(t, 55554))
272272

273273
sc, stdout, stderr = cc.Container.AssertExec(t, 15*time.Second,
274-
"bash", "-c", `SPLUNK_DISCOVERY_LOG_LEVEL=error SPLUNK_DEBUG_CONFIG_SERVER=false \
274+
"sh", "-c", `SPLUNK_DISCOVERY_LOG_LEVEL=error SPLUNK_DEBUG_CONFIG_SERVER=false \
275275
REFRESH_INTERVAL=1s \
276276
SPLUNK_DISCOVERY_DURATION=9s \
277277
SPLUNK_DISCOVERY_RECEIVERS_prometheus_simple_CONFIG_labels_x3a__x3a_label_three=actual.label.three.value.from.env.var.property \

tests/general/dry_run_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,21 @@ service:
6565
},
6666
).WithArgs("-c", "trap exit SIGTERM ; echo ok ; while true; do : ; done")
6767
cc := c.(*testutils.CollectorContainer)
68-
cc.Container = cc.Container.WithEntrypoint("bash").WillWaitForLogs("ok")
68+
cc.Container = cc.Container.WithEntrypoint("sh").WillWaitForLogs("ok")
6969
return cc
7070
},
7171
)
7272

7373
defer shutdown()
7474

7575
sc, stdout, _ := c.Container.AssertExec(t, 15*time.Second,
76-
"bash", "-c", "/otelcol --dry-run 2>/dev/null",
76+
"sh", "-c", "/otelcol --dry-run 2>/dev/null",
7777
)
7878
require.Equal(t, config, stdout)
7979
require.Zero(t, sc)
8080

8181
// confirm successful service functionality
82-
sc, _, _ = c.Container.AssertExec(t, 15*time.Second, "bash", "-c", "/otelcol &")
82+
sc, _, _ = c.Container.AssertExec(t, 15*time.Second, "sh", "-c", "/otelcol &")
8383
require.Zero(t, sc)
8484

8585
expectedResourceMetrics := tc.ResourceMetrics("cpu.yaml")

tests/general/validate_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func TestCoreValidateDefaultConfig(t *testing.T) {
4343
},
4444
).WithArgs("-c", "trap exit SIGTERM ; echo ok ; while true; do : ; done")
4545
cc := c.(*testutils.CollectorContainer)
46-
cc.Container = cc.Container.WithEntrypoint("bash").WillWaitForLogs("ok")
46+
cc.Container = cc.Container.WithEntrypoint("sh").WillWaitForLogs("ok")
4747
return cc
4848
},
4949
)
@@ -54,7 +54,7 @@ func TestCoreValidateDefaultConfig(t *testing.T) {
5454
config := config
5555
t.Run(config, func(t *testing.T) {
5656
sc, stdout, stderr := c.Container.AssertExec(t, 15*time.Second,
57-
"bash", "-c", fmt.Sprintf("/otelcol --config /etc/otel/collector/%s_config.yaml validate", config),
57+
"sh", "-c", fmt.Sprintf("/otelcol --config /etc/otel/collector/%s_config.yaml validate", config),
5858
)
5959
assert.Zero(t, sc)
6060
require.Empty(t, stdout)
@@ -95,15 +95,15 @@ service:
9595
},
9696
).WithArgs("-c", "trap exit SIGTERM ; echo ok ; while true; do : ; done")
9797
cc := c.(*testutils.CollectorContainer)
98-
cc.Container = cc.Container.WithEntrypoint("bash").WillWaitForLogs("ok")
98+
cc.Container = cc.Container.WithEntrypoint("sh").WillWaitForLogs("ok")
9999
return cc
100100
},
101101
)
102102

103103
defer shutdown()
104104

105105
sc, stdout, stderr := c.Container.AssertExec(t, 15*time.Second,
106-
"bash", "-c", "/otelcol validate",
106+
"sh", "-c", "/otelcol validate",
107107
)
108108
assert.Zero(t, sc)
109109
require.Empty(t, stdout)
@@ -141,15 +141,15 @@ service:
141141
},
142142
).WithArgs("-c", "trap exit SIGTERM ; echo ok ; while true; do : ; done")
143143
cc := c.(*testutils.CollectorContainer)
144-
cc.Container = cc.Container.WithEntrypoint("bash").WillWaitForLogs("ok")
144+
cc.Container = cc.Container.WithEntrypoint("sh").WillWaitForLogs("ok")
145145
return cc
146146
},
147147
)
148148

149149
defer shutdown()
150150

151151
sc, stdout, stderr := c.Container.AssertExec(t, 15*time.Second,
152-
"bash", "-c", "/otelcol validate",
152+
"sh", "-c", "/otelcol validate",
153153
)
154154
require.Equal(t, 1, sc)
155155
require.Empty(t, stdout)

tests/testutils/container_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ func TestDockerBuilderMethods(t *testing.T) {
7474
assert.NotSame(t, builder, withEntrypoint)
7575
assert.Empty(t, builder.Entrypoint)
7676

77-
withCmd := builder.WithCmd("bash", "-c", "'sleep inf'")
78-
assert.Equal(t, []string{"bash", "-c", "'sleep inf'"}, withCmd.Cmd)
77+
withCmd := builder.WithCmd("sh", "-c", "'sleep inf'")
78+
assert.Equal(t, []string{"sh", "-c", "'sleep inf'"}, withCmd.Cmd)
7979
assert.NotSame(t, builder, withCmd)
8080
assert.Empty(t, builder.Cmd)
8181

0 commit comments

Comments
 (0)