"fmt"
"io"
"strings"
+
+ "github.com/gohugoio/hugo/htesting"
"sync"
"testing"
"time"
}
func TestFileCacheConcurrent(t *testing.T) {
+ htesting.SkipSlowTestUnlessCI(t)
t.Parallel()
c := qt.New(t)
return DiffStringSlices(strings.Fields(s1), strings.Fields(s2))
}
+// SkipSlowTestUnlessCI skips the test unless we're running in a CI server.
+// Note that you can set CI_LOCAL=1 to run slow tests locally in a CI-like setup.
+func SkipSlowTestUnlessCI(t testing.TB) {
+ if !IsCI() {
+ t.Skip("skipping slow test in CI")
+ }
+}
+
// IsCI reports whether we're running in a CI server.
func IsCI() bool {
return (os.Getenv("CI") != "" || os.Getenv("CI_LOCAL") != "") && os.Getenv("CIRCLE_BRANCH") == ""
"github.com/bep/logg"
"github.com/gohugoio/hugo/common/hmaps"
+ "github.com/gohugoio/hugo/htesting"
"github.com/gohugoio/hugo/config"
"github.com/gohugoio/hugo/config/allconfig"
// Issue #11089
func TestHugoConfigSliceOverrides(t *testing.T) {
+ htesting.SkipSlowTestUnlessCI(t)
t.Parallel()
filesTemplate := `
var filesBuilder strings.Builder
filesBuilder.WriteString(`
-- hugo.toml --
-timeout = 5
+timeout = '100ms'
-- layouts/single.html --
{{ .WordCount }}
-- layouts/_shortcodes/c.html --
{{ end }}
`)
- for i := 1; i < 100; i++ {
+ for i := range 20 {
filesBuilder.WriteString(fmt.Sprintf(`
-- content/page%d.md --
---
func TestPageSummary(t *testing.T) {
t.Parallel()
+ htesting.SkipSlowTestUnlessCI(t)
assertFunc := func(t *testing.T, ext string, pages page.Pages) {
p := pages[0]
checkPageTitle(t, p, "SimpleWithoutSummaryDelimiter")
}
func TestPageWithDelimiter(t *testing.T) {
+ htesting.SkipSlowTestUnlessCI(t)
t.Parallel()
assertFunc := func(t *testing.T, ext string, pages page.Pages) {
p := pages[0]
func TestPageWithSummaryParameter(t *testing.T) {
t.Parallel()
+ htesting.SkipSlowTestUnlessCI(t)
assertFunc := func(t *testing.T, ext string, pages page.Pages) {
p := pages[0]
checkPageTitle(t, p, "SimpleWithSummaryParameter")
// Issue #3854
// Also see https://github.com/gohugoio/hugo/issues/3977
func TestPageWithDateFields(t *testing.T) {
+ t.Parallel()
+ htesting.SkipSlowTestUnlessCI(t)
+
c := qt.New(t)
pageWithDate := `---
title: P%d
return fmt.Sprintf(pageWithDate, weight, weight, field)
}
- t.Parallel()
assertFunc := func(t *testing.T, ext string, pages page.Pages) {
c.Assert(len(pages) > 0, qt.Equals, true)
for _, p := range pages {
}
func TestPageWithMoreTag(t *testing.T) {
+ htesting.SkipSlowTestUnlessCI(t)
t.Parallel()
assertFunc := func(t *testing.T, ext string, pages page.Pages) {
p := pages[0]
// #2973
func TestSummaryWithHTMLTagsOnNextLine(t *testing.T) {
+ htesting.SkipSlowTestUnlessCI(t)
assertFunc := func(t *testing.T, ext string, pages page.Pages) {
c := qt.New(t)
p := pages[0]
// Issue 8919
func TestContentProviderWithCustomOutputFormat(t *testing.T) {
t.Parallel()
+ htesting.SkipSlowTestUnlessCI(t)
files := `
-- hugo.toml --
func TestWordCountWithAllCJKRunesWithoutHasCJKLanguage(t *testing.T) {
t.Parallel()
+ htesting.SkipSlowTestUnlessCI(t)
assertFunc := func(t *testing.T, ext string, pages page.Pages) {
p := pages[0]
if p.WordCount(context.Background()) != 8 {
func TestWordCountWithAllCJKRunesHasCJKLanguage(t *testing.T) {
t.Parallel()
+ htesting.SkipSlowTestUnlessCI(t)
settings := map[string]any{"hasCJKLanguage": true}
assertFunc := func(t *testing.T, ext string, pages page.Pages) {
func TestWordCountWithMainEnglishWithCJKRunes(t *testing.T) {
t.Parallel()
+ htesting.SkipSlowTestUnlessCI(t)
settings := map[string]any{"hasCJKLanguage": true}
assertFunc := func(t *testing.T, ext string, pages page.Pages) {
func TestWordCountWithIsCJKLanguageFalse(t *testing.T) {
t.Parallel()
+ htesting.SkipSlowTestUnlessCI(t)
settings := map[string]any{
"hasCJKLanguage": true,
}
func TestWordCount(t *testing.T) {
t.Parallel()
+ htesting.SkipSlowTestUnlessCI(t)
assertFunc := func(t *testing.T, ext string, pages page.Pages) {
p := pages[0]
if p.WordCount(context.Background()) != 483 {
"github.com/bep/logg"
"github.com/gohugoio/hugo/common/paths"
+ "github.com/gohugoio/hugo/htesting"
"github.com/gohugoio/hugo/hugolib"
"github.com/gohugoio/hugo/internal/js/esbuild"
)
}
func TestBatch(t *testing.T) {
+ htesting.SkipSlowTestUnlessCI(t)
files := `
-- hugo.toml --
disableKinds = ["taxonomy", "term"]
)
func TestClient(t *testing.T) {
+ htesting.SkipSlowTestUnlessCI(t)
modName := "hugo-modules-basic-test"
modPath := "github.com/gohugoio/tests/" + modName
defaultImport := "modh2_2"
"strings"
"testing"
+ "github.com/gohugoio/hugo/htesting"
"github.com/gohugoio/hugo/resources/images/imagetesting"
)
// Note, if you're enabling writeGoldenFiles on a MacOS ARM 64 you need to run the test with GOARCH=amd64, e.g.
func TestImagesGoldenFiltersMisc(t *testing.T) {
t.Parallel()
+ htesting.SkipSlowTestUnlessCI(t)
if imagetesting.SkipGoldenTests {
t.Skip("Skip golden test on this architecture")
func TestImagesGoldenFiltersMask(t *testing.T) {
t.Parallel()
+ htesting.SkipSlowTestUnlessCI(t)
if imagetesting.SkipGoldenTests {
t.Skip("Skip golden test on this architecture")
// Issue 13272, 13273.
func TestImagesGoldenFiltersMaskCacheIssues(t *testing.T) {
+ htesting.SkipSlowTestUnlessCI(t)
if imagetesting.SkipGoldenTests {
t.Skip("Skip golden test on this architecture")
}
func TestImagesGoldenProcessWebP(t *testing.T) {
t.Parallel()
+ htesting.SkipSlowTestUnlessCI(t)
if imagetesting.SkipGoldenTests {
t.Skip("Skip golden test on this architecture")
func TestImagesGoldenWebPAnimation(t *testing.T) {
t.Parallel()
+ htesting.SkipSlowTestUnlessCI(t)
if imagetesting.SkipGoldenTests {
t.Skip("Skip golden test on this architecture")
func TestImagesGoldenMethods(t *testing.T) {
t.Parallel()
+ htesting.SkipSlowTestUnlessCI(t)
if imagetesting.SkipGoldenTests {
t.Skip("Skip golden test on this architecture")
func TestImagesGoldenConfigLossyVsQuality(t *testing.T) {
t.Parallel()
+ htesting.SkipSlowTestUnlessCI(t)
if imagetesting.SkipGoldenTests {
t.Skip("Skip golden test on this architecture")
"strings"
"testing"
+ "github.com/gohugoio/hugo/htesting"
"github.com/gohugoio/hugo/hugolib"
)
func TestGetRemoteRetry(t *testing.T) {
t.Parallel()
+ htesting.SkipSlowTestUnlessCI(t)
temporaryHTTPCodes := []int{408, 429, 500, 502, 503, 504}
numPages := 20
func TestTailwindCSSNoInlineImportsIssue13719(t *testing.T) {
t.Parallel()
+ htesting.SkipSlowTestUnlessCI(t)
files := `
-- hugo.toml --
"github.com/bep/logg"
"github.com/gohugoio/hugo/common/hmaps"
+ "github.com/gohugoio/hugo/htesting"
qt "github.com/frankban/quicktest"
)
func TestGetCSV(t *testing.T) {
t.Parallel()
+ htesting.SkipSlowTestUnlessCI(t)
+
c := qt.New(t)
for i, test := range []struct {
func TestGetJSON(t *testing.T) {
t.Parallel()
+ htesting.SkipSlowTestUnlessCI(t)
c := qt.New(t)
for i, test := range []struct {
qt "github.com/frankban/quicktest"
+ "github.com/gohugoio/hugo/htesting"
"github.com/gohugoio/hugo/htesting/hqt"
"github.com/gohugoio/hugo/hugolib"
)
}
func TestIncludeTimeout(t *testing.T) {
+ htesting.SkipSlowTestUnlessCI(t)
t.Parallel()
files := `
"testing"
qt "github.com/frankban/quicktest"
+ "github.com/gohugoio/hugo/htesting"
"github.com/gohugoio/hugo/htesting/hqt"
"github.com/gohugoio/hugo/hugolib"
)
// shortcodes in v0.141.0, replacing them with x and x_simple.
func TestXShortcodes(t *testing.T) {
t.Parallel()
+ htesting.SkipSlowTestUnlessCI(t)
files := `
-- hugo.toml --
"testing"
qt "github.com/frankban/quicktest"
+ "github.com/gohugoio/hugo/htesting"
"github.com/gohugoio/hugo/hugolib"
"github.com/gohugoio/hugo/resources/kinds"
"github.com/gohugoio/hugo/resources/page"
func TestCreateManyTemplateStores(t *testing.T) {
t.Parallel()
+ htesting.SkipSlowTestUnlessCI(t)
b := hugolib.Test(t, newSetupTestSites)
store := b.H.TemplateStore
func TestTemplateLoop(t *testing.T) {
t.Parallel()
+ htesting.SkipSlowTestUnlessCI(t)
files := `
-- hugo.toml --