Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): Add a test to assert conf files aren't overwritten #18728

Merged
merged 4 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Loading