diff --git a/pkg/shaman/checkout/checkout_test.go b/pkg/shaman/checkout/checkout_test.go index f78164ed..53f0cd07 100644 --- a/pkg/shaman/checkout/checkout_test.go +++ b/pkg/shaman/checkout/checkout_test.go @@ -9,9 +9,12 @@ import ( "github.com/stretchr/testify/assert" "projects.blender.org/studio/flamenco/pkg/api" "projects.blender.org/studio/flamenco/pkg/shaman/filestore" + "projects.blender.org/studio/flamenco/pkg/shaman/testsupport" ) func TestCheckout(t *testing.T) { + testsupport.SkipTestIfUnableToSymlink(t) + manager, cleanup := createTestManager() defer cleanup() ctx := context.Background() diff --git a/pkg/shaman/checkout/manager_test.go b/pkg/shaman/checkout/manager_test.go index b976d0c1..ebd7d319 100644 --- a/pkg/shaman/checkout/manager_test.go +++ b/pkg/shaman/checkout/manager_test.go @@ -36,6 +36,7 @@ import ( "projects.blender.org/studio/flamenco/pkg/api" "projects.blender.org/studio/flamenco/pkg/shaman/config" "projects.blender.org/studio/flamenco/pkg/shaman/filestore" + "projects.blender.org/studio/flamenco/pkg/shaman/testsupport" ) func createTestManager() (*Manager, func()) { @@ -46,6 +47,8 @@ func createTestManager() (*Manager, func()) { } func TestSymlinkToCheckout(t *testing.T) { + testsupport.SkipTestIfUnableToSymlink(t) + manager, cleanup := createTestManager() defer cleanup() @@ -101,6 +104,8 @@ func TestPrepareCheckout(t *testing.T) { } func TestEraseCheckout(t *testing.T) { + testsupport.SkipTestIfUnableToSymlink(t) + manager, cleanup := createTestManager() defer cleanup() ctx := context.Background() diff --git a/pkg/shaman/cleanup_test.go b/pkg/shaman/cleanup_test.go index f45d809e..584dda43 100644 --- a/pkg/shaman/cleanup_test.go +++ b/pkg/shaman/cleanup_test.go @@ -36,6 +36,7 @@ import ( "projects.blender.org/studio/flamenco/pkg/shaman/config" "projects.blender.org/studio/flamenco/pkg/shaman/filestore" "projects.blender.org/studio/flamenco/pkg/shaman/jwtauth" + "projects.blender.org/studio/flamenco/pkg/shaman/testsupport" ) func createTestShaman() (*Server, func()) { @@ -116,6 +117,8 @@ func TestGCFindOldFiles(t *testing.T) { // Test of the lower-level functions of the garbage collector. func TestGCComponents(t *testing.T) { + testsupport.SkipTestIfUnableToSymlink(t) + server, cleanup := createTestShaman() defer cleanup() @@ -200,6 +203,8 @@ func TestGCComponents(t *testing.T) { // Test of the high-level GCStorage() function. func TestGarbageCollect(t *testing.T) { + testsupport.SkipTestIfUnableToSymlink(t) + server, cleanup := createTestShaman() defer cleanup() diff --git a/pkg/shaman/testsupport/testsupport.go b/pkg/shaman/testsupport/testsupport.go new file mode 100644 index 00000000..41817f01 --- /dev/null +++ b/pkg/shaman/testsupport/testsupport.go @@ -0,0 +1,17 @@ +package testsupport + +import ( + "testing" + + "projects.blender.org/studio/flamenco/pkg/sysinfo" +) + +func SkipTestIfUnableToSymlink(t *testing.T) { + can, err := sysinfo.CanSymlink() + switch { + case err != nil: + t.Fatalf("error checking platform symlinking capabilities: %v", err) + case !can: + t.Skip("symlinking not possible on current platform") + } +}