File: tests.sh

package info (click to toggle)
git-secret 0.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,724 kB
  • sloc: sh: 4,580; makefile: 162; xml: 31; python: 22
file content (31 lines) | stat: -rwxr-xr-x 729 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash

# `SECRETS_PROJECT_ROOT` must be set before running the script.

set -e

TEST_DIR=/tmp/git-secret-test

rm -rf "${TEST_DIR}"
mkdir "${TEST_DIR}"
echo "# created dir: ${TEST_DIR}"

chmod 0700 "${TEST_DIR}"
(
    cd "$TEST_DIR"

    # test with non-standard SECRETS_DIR (normally .gitsecret)
    # and SECRETS_EXTENSION (normally .secret)
    export SECRETS_DIR='.gitsec'
    export SECRETS_EXTENSION='.sec'

    export TMPDIR="$TEST_DIR"
    echo "# TMPDIR is $TMPDIR"

    # bats expects diagnostic lines to be sent to fd 3, matching regex '^# '
    #  (IE, like: `echo '# message here' >&3`).
    # bats ... 3>&1 shows diagnostic output
    bats "${SECRETS_PROJECT_ROOT}/tests" 3>&1
)

rm -rf "${TEST_DIR}"