Skip to content

Commit

Permalink
Fix unit tests to pass for newer OpenSSL versions
Browse files Browse the repository at this point in the history
Adjust a couple of output checks to look for expected text anywhere
in the output, instead of at specific lines, so tests will pass
despite warning output like this:

    *** WARNING : deprecated key derivation used.
    Using -iter or -pbkdf2 would be better.

See also #55
  • Loading branch information
jmurty committed Jun 2, 2020
1 parent fc59f0d commit bd4d2a5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/run-bats-core-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ on:

jobs:
test:
# We use older Ubuntu for now to avoid warning from newer OpenSSL (#55)
# which break output expectations in some (fragile) tests
runs-on: ubuntu-16.04
# Test on older Ubuntu with OpenSSL < 1.1 and newer with OpenSSL >= 1.1
runs-on: [ubuntu-16.04, ubuntu-18.04]

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
Expand Down
2 changes: 1 addition & 1 deletion tests/test_merge.bats
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ load $BATS_TEST_DIRNAME/_test_helper.bash

run git merge branch-2
[ "$status" -ne 0 ]
[ "${lines[1]}" = "CONFLICT (content): Merge conflict in sensitive_file" ]
[[ "${output}" = *"CONFLICT (content): Merge conflict in sensitive_file"* ]]

run cat sensitive_file
[ "$status" -eq 0 ]
Expand Down
10 changes: 5 additions & 5 deletions tests/test_pre_commit.bats
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ load $BATS_TEST_DIRNAME/_test_helper.bash
# an encrypted file
run git commit -m "Added more"
[ "$status" -ne 0 ]
[ "${lines[0]}" = "Transcrypt managed file is not encrypted in the Git index: sensitive_file" ]
[ "${lines[1]}" = "You probably staged this file using a tool that does not apply .gitattribute filters as required by Transcrypt." ]
[ "${lines[2]}" = "Fix this by re-staging the file with a compatible tool or with Git on the command line:" ]
[ "${lines[3]}" = " git reset -- sensitive_file" ]
[ "${lines[4]}" = " git add sensitive_file" ]
[[ "${output}" = *"Transcrypt managed file is not encrypted in the Git index: sensitive_file"* ]]
[[ "${output}" = *"You probably staged this file using a tool that does not apply .gitattribute filters as required by Transcrypt."* ]]
[[ "${output}" = *"Fix this by re-staging the file with a compatible tool or with Git on the command line:"* ]]
[[ "${output}" = *" git reset -- sensitive_file"* ]]
[[ "${output}" = *" git add sensitive_file"* ]]
}

@test "pre-commit: warn and don't clobber existing pre-commit hook on init" {
Expand Down

0 comments on commit bd4d2a5

Please sign in to comment.