Skip to content

Commit

Permalink
test: Further test improvements for the new install stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed Feb 26, 2024
1 parent 354a8df commit 29d1a0f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
10 changes: 4 additions & 6 deletions package/unios_2.x.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ _tailscale_stop() {
}

_tailscale_install() {
if [ -z "${VERSION_CODENAME}" ]; then
# shellcheck source=tests/os-release
. /etc/os-release
fi
# shellcheck source=tests/os-release
. "${OS_RELEASE_FILE:-/etc/os-release}"

# Load the tailscale-env file to discover the flags which are required to be set
# shellcheck source=package/tailscale-env
Expand All @@ -47,8 +45,8 @@ _tailscale_install() {
curl -fsSL --ipv4 "https://pkgs.tailscale.com/${TAILSCALE_CHANNEL}/${ID}/${VERSION_CODENAME}.gpg" | apt-key add -
curl -fsSL --ipv4 "https://pkgs.tailscale.com/${TAILSCALE_CHANNEL}/${ID}/${VERSION_CODENAME}.list" | tee /etc/apt/sources.list.d/tailscale.list
else
curl -fsSLo /usr/share/keyrings/tailscale-archive-keyring.gpg --ipv4 "https://pkgs.tailscale.com/${TAILSCALE_CHANNEL}/${ID}/${VERSION_CODENAME}.noarmor.gpg"
curl -fsSLo /etc/apt/sources.list.d/tailscale.list --ipv4 "https://pkgs.tailscale.com/${TAILSCALE_CHANNEL}/${ID}/${VERSION_CODENAME}.tailscale-keyring.list"
curl -fsSL --ipv4 "https://pkgs.tailscale.com/${TAILSCALE_CHANNEL}/${ID}/${VERSION_CODENAME}.noarmor.gpg" | tee /usr/share/keyrings/tailscale-archive-keyring.gpg > /dev/null
curl -fsSL --ipv4 "https://pkgs.tailscale.com/${TAILSCALE_CHANNEL}/${ID}/${VERSION_CODENAME}.tailscale-keyring.list" | tee /etc/apt/sources.list.d/tailscale.list > /dev/null
fi

echo "Updating package lists..."
Expand Down
5 changes: 3 additions & 2 deletions tests/install.1.x.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ export TAILSCALED_SOCK="${WORKDIR}/tailscaled.sock"
export PATH="${WORKDIR}:${PATH}"
mock "${WORKDIR}/ubnt-device-info" "1.0.0"

# shellcheck source=tests/os-release
. "${ROOT}/tests/os-release"
cp "${ROOT}/tests/os-release" "${WORKDIR}/os-release"
export OS_RELEASE_FILE="${WORKDIR}/os-release"

cp "${PACKAGE_ROOT}/tailscale-env" "${WORKDIR}/tailscale-env"

"${ROOT}/package/manage.sh" install; assert "Tailscale installer should run successfully"
Expand Down
5 changes: 3 additions & 2 deletions tests/install.2.x.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ esac
EOF
chmod +x "${WORKDIR}/systemctl"

# shellcheck source=tests/os-release
. "${ROOT}/tests/os-release"
cp "${ROOT}/tests/os-release" "${WORKDIR}/os-release"
export OS_RELEASE_FILE="${WORKDIR}/os-release"

cp "${PACKAGE_ROOT}/tailscale-env" "${WORKDIR}/tailscale-env"

"${ROOT}/package/manage.sh" install; assert "Tailscale installer should run successfully"
Expand Down
1 change: 1 addition & 0 deletions tests/status.2.x.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export TAILSCALED_SOCK="${WORKDIR}/tailscaled.sock"

export PATH="${WORKDIR}:${PATH}"
mock "${WORKDIR}/ubnt-device-info" "2.0.0"
mock "${WORKDIR}/systemctl" "" 1

assert_eq "$("${ROOT}/package/manage.sh" status)" "Tailscale is not installed" "Tailscaled should be reported as not installed"

Expand Down

0 comments on commit 29d1a0f

Please sign in to comment.