Skip to content

Commit

Permalink
Add integration testing utilities
Browse files Browse the repository at this point in the history
  • Loading branch information
Bios-Marcel committed Nov 23, 2023
1 parent 3b38c54 commit 42b2514
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*
!wastebasket.test*

9 changes: 9 additions & 0 deletions test.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# remove preexisting test binaries from other systems to keep build context small
Remove-Item wastebasket.test*

# read the first arg or default to "windows"
$os = $args[0] ?? "windows"
$env:GOOS=$os; go test -c .
$env:DOCKER_CONTEXT="desktop-$os"; docker build -t temp_test -f ".\test_$os.Dockerfile" .
docker image rm temp_test

8 changes: 8 additions & 0 deletions test_linux.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# nanoserver doesn't have a shell, so we can't run the test, as we require
# shell systemcalls such as SHFileOperationW.
FROM docker.io/debian:trixie-slim

WORKDIR /test
copy wastebasket.test ./test
RUN ./test

8 changes: 8 additions & 0 deletions test_windows.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# nanoserver doesn't have a shell, so we can't run the test, as we require
# shell systemcalls such as SHFileOperationW.
FROM mcr.microsoft.com/windows/servercore:ltsc2022-amd64

WORKDIR /test
copy wastebasket.test.exe ./test.exe
RUN test.exe

0 comments on commit 42b2514

Please sign in to comment.