diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml new file mode 100644 index 000000000..2aa903b5d --- /dev/null +++ b/.github/workflows/windows.yaml @@ -0,0 +1,23 @@ +name: Windows Test +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] +jobs: + build: + strategy: + matrix: + go-versions: [1.13.x] + platform: [windows-latest] + runs-on: ${{ matrix.platform }} + steps: + - name: Install Go + uses: actions/setup-go@v1 + with: + go-version: ${{ matrix.go-version }} + - name: Checkout code + uses: actions/checkout@v2 + - name: Run Windows Unit Tests + run: | + go test -v -race ./pkg/... \ No newline at end of file diff --git a/pkg/blob/nodeserver_test.go b/pkg/blob/nodeserver_test.go index 0e0a1e0ec..39bb8b601 100644 --- a/pkg/blob/nodeserver_test.go +++ b/pkg/blob/nodeserver_test.go @@ -22,6 +22,7 @@ import ( "fmt" "os" "reflect" + "runtime" "syscall" "testing" @@ -125,7 +126,13 @@ func TestEnsureMountPoint(t *testing.T) { func TestNodePublishVolume(t *testing.T) { volumeCap := csi.VolumeCapability_AccessMode{Mode: csi.VolumeCapability_AccessMode_MULTI_NODE_MULTI_WRITER} - + createDirError := status.Errorf(codes.Internal, + "Could not mount target \"./azure.go\": mkdir ./azure.go: not a directory") + if runtime.GOOS == "windows" { + createDirError = status.Errorf(codes.Internal, + "Could not mount target \"./azure.go\": mkdir ./azure.go: "+ + "The system cannot find the path specified.") + } tests := []struct { desc string req csi.NodePublishVolumeRequest @@ -170,7 +177,7 @@ func TestNodePublishVolume(t *testing.T) { TargetPath: "./azure.go", StagingTargetPath: sourceTest, Readonly: true}, - expectedErr: status.Errorf(codes.Internal, "Could not mount target \"./azure.go\": mkdir ./azure.go: not a directory"), + expectedErr: createDirError, }, { desc: "Error mounting resource busy", @@ -198,7 +205,7 @@ func TestNodePublishVolume(t *testing.T) { _, err := d.NodePublishVolume(context.Background(), &test.req) if !reflect.DeepEqual(err, test.expectedErr) { - t.Errorf("Unexpected error: %v", err) + t.Errorf("Desc: %s - Unexpected error: %v - Expected: %v", test.desc, err, test.expectedErr) } }