Skip to content

Commit 4a99489

Browse files
authored
Merge pull request #3000 from aws-observability/rmprint
[chore] Remove print statements and add unit test in script
2 parents 2cc4878 + 87cdaa2 commit 4a99489

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
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() {

tools/ctl/windows/aws-otel-collector-ctl.ps1

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ Function Get-Service-Config-Uri() {
8989
return $Matches.1
9090
}
9191

92-
93-
9492
Function Set-Service-Config-Uri ([string]$uri) {
9593
$aoc_cmd = "\""${AOCProgramFiles}\.aws-otel-collector.exe\"" --config=\""${uri}\"""
9694
sc.exe config "${AOCServiceName}" binPath= "${aoc_cmd}"
@@ -112,7 +110,6 @@ Function AOCStart() {
112110

113111
# Check for feature gates before configuring service
114112
if ($FeatureGates) {
115-
Write-Output "Applying feature gate"
116113
if (Test-Remote-Uri $ConfigLocation) {
117114
Set-Service-Config-Uri-With-FeatureGates ${ConfigLocation} ${FeatureGates}
118115
} else {

0 commit comments

Comments
 (0)