-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): Add a test to assert conf files aren't overwritten (#18728)
* chore(ci): Add a test to assert conf files aren't overwritten Signed-off-by: Jesse Szwedko <jesse.szwedko@datadoghq.com> * shell check Signed-off-by: Jesse Szwedko <jesse.szwedko@datadoghq.com> --------- Signed-off-by: Jesse Szwedko <jesse.szwedko@datadoghq.com>
- Loading branch information
Showing
2 changed files
with
33 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,40 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
# verify-install.sh | ||
# verify-install.sh <package> | ||
# | ||
# SUMMARY | ||
# | ||
# Verifies vector packages have been installed correctly | ||
|
||
package="${1:?must pass package as argument}" | ||
|
||
install_package () { | ||
case "$1" in | ||
*.deb) | ||
dpkg -i "$1" | ||
;; | ||
*.rpm) | ||
rpm -i --replacepkgs "$1" | ||
;; | ||
esac | ||
} | ||
|
||
install_package "$package" | ||
|
||
getent passwd vector || (echo "vector user missing" && exit 1) | ||
getent group vector || (echo "vector group missing" && exit 1) | ||
vector --version || (echo "vector --version failed" && exit 1) | ||
test -f /etc/default/vector || (echo "/etc/default/vector doesn't exist" && exit 1) | ||
test -f /etc/vector/vector.yaml || (echo "/etc/vector/vector.yaml doesn't exist" && exit 1) | ||
|
||
echo "FOO=bar" > /etc/default/vector | ||
echo "foo: bar" > /etc/vector/vector.yaml | ||
|
||
install_package "$package" | ||
|
||
getent passwd vector || (echo "vector user missing" && exit 1) | ||
getent group vector || (echo "vector group missing" && exit 1) | ||
vector --version || (echo "vector --version failed" && exit 1) | ||
grep -q "FOO=bar" "/etc/default/vector" || (echo "/etc/default/vector has incorrect contents" && exit 1) | ||
grep -q "foo: bar" "/etc/vector/vector.yaml" || (echo "/etc/vector/vector.yaml has incorrect contents" && exit 1) |