Skip to content

Commit

Permalink
Merge pull request #2676 from gavindidrichsen/gavindidrichsen/acl_add…
Browse files Browse the repository at this point in the history
…_tests

[acl] Add tests to core/acl for linux plan
  • Loading branch information
echohack authored Jun 26, 2019
2 parents 8f387ab + e8d8afb commit 85e5adb
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
4 changes: 4 additions & 0 deletions acl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ Binary package
## Usage

*TODO: Add instructions for usage*

# Testing

To run tests follow the example in the latest [test standards document](https://github.com/habitat-sh/core-plans/blob/master/docs/dev/policy_documents/standards-for-tests.md).
5 changes: 5 additions & 0 deletions acl/tests/test.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@test "Version matches plan" {
TEST_PKG_VERSION="$(echo "${TEST_PKG_IDENT}" | cut -d/ -f3)"
actual_version="$(hab pkg exec "${TEST_PKG_IDENT}" getfacl --version | awk '{print $2}')"
[[ "$actual_version" = "${TEST_PKG_VERSION}" ]]
}
22 changes: 22 additions & 0 deletions acl/tests/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh
set -euo pipefail

#/ Usage: test.sh <pkg_ident>
#/
#/ Example: test.sh core/opa/0.11.0/20190531065119
#/

TESTDIR="$(dirname "${0}")"

if [[ -z "${1:-}" ]]; then
grep '^#/' < "${0}" | cut -c4-
exit 1
fi

TEST_PKG_IDENT="$1"

hab pkg install core/bats --binlink
hab pkg install "$TEST_PKG_IDENT"

export TEST_PKG_IDENT
bats "${TESTDIR}/test.bats"

0 comments on commit 85e5adb

Please sign in to comment.