Fix two tests that are broken on Windows

Put guards around TestPageBundlerCaptureSymlinks and
TestPageBundlerSiteWitSymbolicLinksInContent so that they aren't
run on Windows (they both use symbolic links and the Go library
implementation requires administrator mode on Windows).
This commit is contained in:
Brian Fitzgerald authored and Bjørn Erik Pedersen committed 2018-04-05 08:35:06 +02:00
1 parent 730b66b652
commit 26f34fd59d
2 files changed
+10 -1

No files matched your search

+6 -1
View File
@@ -22,6 +22,7 @@ import (
jww "github.com/spf13/jwalterweatherman" jww "github.com/spf13/jwalterweatherman"
"runtime"
"strings" "strings"
"sync" "sync"
"testing" "testing"
@@ -82,6 +83,10 @@ func (s *storeFilenames) sortedStr() string {
} }
func TestPageBundlerCaptureSymlinks(t *testing.T) { func TestPageBundlerCaptureSymlinks(t *testing.T) {
if runtime.GOOS == "windows" && os.Getenv("CI") == "" {
t.Skip("Skip TestPageBundlerCaptureSymlinks as os.Symlink needs administrator rights on Windows")
}
assert := require.New(t) assert := require.New(t)
ps, workDir := newTestBundleSymbolicSources(t) ps, workDir := newTestBundleSymbolicSources(t)
sourceSpec := source.NewSourceSpec(ps, ps.BaseFs.ContentFs) sourceSpec := source.NewSourceSpec(ps, ps.BaseFs.ContentFs)
@@ -92,7 +97,7 @@ func TestPageBundlerCaptureSymlinks(t *testing.T) {
assert.NoError(c.capture()) assert.NoError(c.capture())
// Symlik back to content skipped to prevent infinite recursion. // Symlink back to content skipped to prevent infinite recursion.
assert.Equal(uint64(3), logger.LogCountForLevelsGreaterThanorEqualTo(jww.LevelWarn)) assert.Equal(uint64(3), logger.LogCountForLevelsGreaterThanorEqualTo(jww.LevelWarn))
expected := ` expected := `
+4
View File
@@ -308,6 +308,10 @@ func TestMultilingualDisableLanguage(t *testing.T) {
} }
func TestPageBundlerSiteWitSymbolicLinksInContent(t *testing.T) { func TestPageBundlerSiteWitSymbolicLinksInContent(t *testing.T) {
if runtime.GOOS == "windows" && os.Getenv("CI") == "" {
t.Skip("Skip TestPageBundlerSiteWitSymbolicLinksInContent as os.Symlink needs administrator rights on Windows")
}
assert := require.New(t) assert := require.New(t)
ps, workDir := newTestBundleSymbolicSources(t) ps, workDir := newTestBundleSymbolicSources(t)
cfg := ps.Cfg cfg := ps.Cfg