Skip to content

Commit

Permalink
test: add compatibility check for git-crypt 0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
maxisam committed Nov 13, 2024
1 parent 4aa7639 commit 60423b7
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/linux/basic-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,19 @@ else
fi

echo "::notice:: ✅ Passed worktree test"

echo "test compatibility with git-crypt 0.7.0"

cd "$PWD"

git crypt unlock "./tests/key.gitcrypt"
# check if tests/fake.test.secrets is decrypted

if xxd "./tests/fake.test.secrets" | grep -q 'GITCRYPT'; then
echo "fake.test.secrets is encrypted"
exit 1
else
echo "fake.test.secrets is decrypted"
echo "::notice:: ✅ Passed compatibility test"
fi

19 changes: 19 additions & 0 deletions tests/windows/basic-test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,25 @@ try {

Write-Host "::notice:: ✅ Passed worktree test"

# Test compatibility with git-crypt 0.7.0
Write-Host "Testing compatibility with git-crypt 0.7.0..."

Set-Location "$PWD"
git crypt unlock "./tests/key.gitcrypt"

# Check if the test file is properly decrypted
$testFilePath = "./tests/fake.test.secrets"
$bytes = [System.IO.File]::ReadAllBytes($testFilePath)[0..8]
$headerString = [System.Text.Encoding]::ASCII.GetString($bytes)

if ($headerString -eq "`0GITCRYPT") {
Write-Error "fake.test.secrets is still encrypted"
exit 1
} else {
Write-Host "fake.test.secrets is decrypted"
Write-Host "::notice:: ✅ Passed compatibility test"
}

} finally {
Pop-Location
Remove-Item -Recurse -Force $TEST_DIR
Expand Down

0 comments on commit 60423b7

Please sign in to comment.