Skip to content

Commit 87cdaa2

Browse files
committed
Add Unit test for restart
1 parent 5ce4e21 commit 87cdaa2

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

.github/scripts/test-collector-ctl.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,26 @@ test_collector_ctl_with_samecfg_restart() {
8787
}
8888

8989
test_collector_ctl_with_featureflag() {
90-
#staart coll default conf by starting without -c
90+
#start collector with default config
9191
$ADOT_CTL -a start -f "-adot.exporter.datadogexporter.deprecation"
9292

9393
echo "${FUNCNAME[0]} ... OK"
9494
}
9595

96+
test_collector_ctl_with_featureflag_samecfg_restart() {
97+
#populate default conf by starting without -c
98+
$ADOT_CTL -a start -f "-adot.exporter.signalfx.deprecation"
99+
100+
#restarting with different flags and -c should start collector as expected
101+
$ADOT_CTL -a start -c "file:/opt/aws/aws-otel-collector/etc/config.yaml" -f "-adot.exporter.datadogexporter.deprecation"
102+
$ADOT_CTL -a status
103+
echo "==============================================="
104+
echo "Contents of $ENV_FILE:"
105+
cat "$ENV_FILE"
106+
echo "==============================================="
107+
echo "${FUNCNAME[0]} ... OK"
108+
}
109+
96110
setup
97111

98112
## Tests
@@ -101,3 +115,4 @@ test_collector_ctl_with_sed_special_chars
101115
test_collector_ctl_with_samecfg
102116
test_collector_ctl_with_samecfg_restart
103117
test_collector_ctl_with_featureflag
118+
test_collector_ctl_with_featureflag_samecfg_restart

tools/ctl/linux/aws-otel-collector-ctl.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ aoc_config_local_uri() {
7575

7676

7777
if [ -n "$config" ] && [ -f "$config" ]; then
78-
# do not copy if the default congif directory is provided for the -f flag.
78+
# do not copy if the default config directory is provided for the -f flag.
7979
# copying a file to the same location produces an error.
8080
if [ ! "$config" = "$CONFDIR/config.yaml" ]; then
8181
cp "$config" $CONFDIR/config.yaml
@@ -91,11 +91,10 @@ aoc_config_feature_gates() {
9191

9292
sed -i '/^feature_gates=.*$/d' $ENV_FILE
9393
if [ -n "$feature_gates" ]; then
94-
echo "feature_gates=\"--feature-gates='${feature_gates}'\"" >> $ENV_FILE
94+
echo "feature_gates=\"--feature-gates '${feature_gates}'\"" >> $ENV_FILE
9595
fi
9696
}
9797

98-
9998
# Used in case the collector starts for the first time without a configuration parameter
10099
# Safe to run as this will not overwrite a file if one exists in default location already.
101100
aoc_ensure_default_config() {

0 commit comments

Comments
 (0)