Skip to content

Commit

Permalink
chore(ci): Add a test to assert conf files aren't overwritten (#18728)
Browse files Browse the repository at this point in the history
* 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
jszwedko authored Oct 3, 2023
1 parent 29e5e22 commit 3ade682
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 15 deletions.
18 changes: 4 additions & 14 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,9 @@ jobs:
with:
name: vector-${{ env.VECTOR_VERSION }}-x86_64-unknown-linux-gnu
path: target/artifacts
- name: First install of DEB package.
- name: Verify install of DEB package.
run: |
dpkg -i target/artifacts/vector_${{ env.VECTOR_VERSION }}-1_amd64.deb
./scripts/verify-install.sh
- name: Second install of DEB package.
run: |
dpkg -i target/artifacts/vector_${{ env.VECTOR_VERSION }}-1_amd64.deb
./scripts/verify-install.sh
./scripts/verify-install.sh target/artifacts/vector_${{ env.VECTOR_VERSION }}-1_amd64.deb
rpm-verify:
name: Verify RPM Packages
Expand Down Expand Up @@ -372,14 +367,9 @@ jobs:
with:
name: vector-${{ env.VECTOR_VERSION }}-x86_64-unknown-linux-gnu
path: target/artifacts
- name: First install of RPM package.
run: |
rpm -i --replacepkgs target/artifacts/vector-${{ env.VECTOR_VERSION }}-1.x86_64.rpm
./scripts/verify-install.sh
- name: Second install of RPM package.
- name: Verify install of RPM package.
run: |
rpm -i --replacepkgs target/artifacts/vector-${{ env.VECTOR_VERSION }}-1.x86_64.rpm
./scripts/verify-install.sh
./scripts/verify-install.sh target/artifacts/vector-${{ env.VECTOR_VERSION }}-1.x86_64.rpm
macos-verify:
name: Verify macOS Package
Expand Down
30 changes: 29 additions & 1 deletion scripts/verify-install.sh
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)

0 comments on commit 3ade682

Please sign in to comment.