From 3b28a89dff61fbacac4b97a921ac79346c56839c Mon Sep 17 00:00:00 2001 From: Adam Shannon Date: Wed, 14 Feb 2024 09:39:30 -0600 Subject: [PATCH] test: fixup for Windows --- .github/workflows/go.yml | 16 ++++++++++++++++ Makefile | 2 +- mock_client_test.go | 5 ++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 8998951d..279116f9 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -23,6 +23,22 @@ jobs: - name: Check out code into the Go module directory uses: actions/checkout@v2 + - name: Switch Docker daemon mode to Linux + if: runner.os == 'Windows' + # Tips from https://stackoverflow.com/a/57081502 + # Install-Module -Name DockerMsftProvider -Force + # Install-Package -Name docker -ProviderName DockerMsftProvider -Force + # + # FRom https://learn.microsoft.com/en-us/virtualization/windowscontainers/quick-start/set-up-environment?tabs=dockerce#windows-server-1 + # Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/Windows-Containers/Main/helpful_tools/Install-DockerCE/install-docker-ce.ps1" -o install-docker-ce.ps1 + # .\install-docker-ce.ps1 + run: | + choco install docker-cli + + DockerCli.exe -help + + C:\"Program Files"\Docker\Docker\DockerCli.exe -SwitchDaemon + - name: Setup run: make setup diff --git a/Makefile b/Makefile index 7b8829b9..89bb10d0 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ all: check .PHONY: check check: ifeq ($(OS),Windows_NT) - @echo "Skipping checks on Windows, currently unsupported." + go test ./... else @wget -O lint-project.sh https://raw.githubusercontent.com/moov-io/infra/master/go/lint-project.sh @chmod +x ./lint-project.sh diff --git a/mock_client_test.go b/mock_client_test.go index c940e2b3..e54f0ac0 100644 --- a/mock_client_test.go +++ b/mock_client_test.go @@ -8,6 +8,7 @@ import ( "errors" "io" "io/fs" + "os" "strings" "testing" @@ -41,7 +42,9 @@ func TestMockClient(t *testing.T) { paths, err := client.ListFiles("/") require.NoError(t, err) require.Len(t, paths, 1) - require.Equal(t, "/exists.txt", paths[0]) + + expected := string(os.PathSeparator) + "exists.txt" + require.Equal(t, expected, paths[0]) } func TestMockClient_ListAndOpenFiles(t *testing.T) {