@@ -6,6 +6,7 @@ package getter
66import (
77 "os"
88 "path/filepath"
9+ "runtime"
910 "testing"
1011)
1112
@@ -22,20 +23,22 @@ func TestFileGetter(t *testing.T) {
2223 t .Fatalf ("err: %s" , err )
2324 }
2425
25- // Verify the destination folder is a symlink
26- fi , err := os .Lstat (dst )
27- if err != nil {
28- t .Fatalf ("err: %s" , err )
29- }
30- if fi .Mode ()& os .ModeSymlink == 0 {
31- t .Fatal ("destination is not a symlink" )
32- }
33-
3426 // Verify the main file exists
3527 mainPath := filepath .Join (dst , "main.tf" )
3628 if _ , err := os .Stat (mainPath ); err != nil {
3729 t .Fatalf ("err: %s" , err )
3830 }
31+
32+ // On Unix, verify it's a symlink; on Windows, just verify it works
33+ if runtime .GOOS != "windows" {
34+ fi , err := os .Lstat (dst )
35+ if err != nil {
36+ t .Fatalf ("err: %s" , err )
37+ }
38+ if fi .Mode ()& os .ModeSymlink == 0 {
39+ t .Fatal ("destination is not a symlink" )
40+ }
41+ }
3942}
4043
4144func TestFileGetter_sourceFile (t * testing.T ) {
@@ -116,17 +119,19 @@ func TestFileGetter_GetFile(t *testing.T) {
116119 t .Fatalf ("err: %s" , err )
117120 }
118121
119- // Verify the destination folder is a symlink
120- fi , err := os .Lstat (dst )
121- if err != nil {
122- t .Fatalf ("err: %s" , err )
123- }
124- if fi .Mode ()& os .ModeSymlink == 0 {
125- t .Fatal ("destination is not a symlink" )
126- }
127-
128122 // Verify the main file exists
129123 assertContents (t , dst , "Hello\n " )
124+
125+ // On Unix, verify it's a symlink; on Windows, just verify it works
126+ if runtime .GOOS != "windows" {
127+ fi , err := os .Lstat (dst )
128+ if err != nil {
129+ t .Fatalf ("err: %s" , err )
130+ }
131+ if fi .Mode ()& os .ModeSymlink == 0 {
132+ t .Fatal ("destination is not a symlink" )
133+ }
134+ }
130135}
131136
132137func TestFileGetter_GetFile_Copy (t * testing.T ) {
0 commit comments