Skip to content

Commit e24b604

Browse files
committed
hugolib: Delete some old integration tests
We have had several had several integration test setups over the years. What we have now, backed by txtar files, has been working very well for a long time. The tests deleted here may lose us some coverage, but they are painful to maintain and it's unlikely that we will port them to the new setup.
1 parent 4c7a78f commit e24b604

File tree

8 files changed

+1
-1089
lines changed

8 files changed

+1
-1089
lines changed

‎hugolib/pagebundler_test.go‎

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,8 @@ import (
2626

2727
"github.com/gohugoio/hugo/hugofs"
2828

29-
"github.com/gohugoio/hugo/resources/kinds"
30-
"github.com/gohugoio/hugo/resources/page"
31-
3229
"github.com/gohugoio/hugo/htesting"
3330

34-
"github.com/gohugoio/hugo/deps"
35-
3631
qt "github.com/frankban/quicktest"
3732
)
3833

@@ -322,93 +317,6 @@ Len Sites: {{ len .Site.Sites }}|
322317
b.Assert(len(b.H.Sites), qt.Equals, 1)
323318
}
324319

325-
func TestPageBundlerHeadless(t *testing.T) {
326-
t.Parallel()
327-
328-
cfg, fs := newTestCfg()
329-
c := qt.New(t)
330-
331-
workDir := "/work"
332-
cfg.Set("workingDir", workDir)
333-
cfg.Set("contentDir", "base")
334-
cfg.Set("baseURL", "https://example.com")
335-
configs, err := loadTestConfigFromProvider(cfg)
336-
c.Assert(err, qt.IsNil)
337-
338-
pageContent := `---
339-
title: "Bundle Galore"
340-
slug: s1
341-
date: 2017-01-23
342-
---
343-
344-
TheContent.
345-
346-
{{< myShort >}}
347-
`
348-
349-
writeSource(t, fs, filepath.Join(workDir, "layouts", "_default", "single.html"), "single {{ .Content }}")
350-
writeSource(t, fs, filepath.Join(workDir, "layouts", "_default", "list.html"), "list")
351-
writeSource(t, fs, filepath.Join(workDir, "layouts", "shortcodes", "myShort.html"), "SHORTCODE")
352-
353-
writeSource(t, fs, filepath.Join(workDir, "base", "a", "index.md"), pageContent)
354-
writeSource(t, fs, filepath.Join(workDir, "base", "a", "l1.png"), "PNG image")
355-
writeSource(t, fs, filepath.Join(workDir, "base", "a", "l2.png"), "PNG image")
356-
357-
writeSource(t, fs, filepath.Join(workDir, "base", "b", "index.md"), `---
358-
title: "Headless Bundle in Topless Bar"
359-
slug: s2
360-
headless: true
361-
date: 2017-01-23
362-
---
363-
364-
TheContent.
365-
HEADLESS {{< myShort >}}
366-
`)
367-
writeSource(t, fs, filepath.Join(workDir, "base", "b", "l1.png"), "PNG image")
368-
writeSource(t, fs, filepath.Join(workDir, "base", "b", "l2.png"), "PNG image")
369-
writeSource(t, fs, filepath.Join(workDir, "base", "b", "p1.md"), pageContent)
370-
371-
s := buildSingleSite(t, deps.DepsCfg{Fs: fs, Configs: configs}, BuildCfg{})
372-
373-
c.Assert(len(s.RegularPages()), qt.Equals, 1)
374-
375-
regular := s.getPageOldVersion(kinds.KindPage, "a/index")
376-
c.Assert(regular.RelPermalink(), qt.Equals, "/s1/")
377-
378-
headless := s.getPageOldVersion(kinds.KindPage, "b/index")
379-
c.Assert(headless, qt.Not(qt.IsNil))
380-
c.Assert(headless.Title(), qt.Equals, "Headless Bundle in Topless Bar")
381-
c.Assert(headless.RelPermalink(), qt.Equals, "")
382-
c.Assert(headless.Permalink(), qt.Equals, "")
383-
c.Assert(content(headless), qt.Contains, "HEADLESS SHORTCODE")
384-
385-
headlessResources := headless.Resources()
386-
c.Assert(len(headlessResources), qt.Equals, 3)
387-
res := headlessResources.Match("l*")
388-
c.Assert(len(res), qt.Equals, 2)
389-
pageResource := headlessResources.GetMatch("p*")
390-
c.Assert(pageResource, qt.Not(qt.IsNil))
391-
p := pageResource.(page.Page)
392-
c.Assert(content(p), qt.Contains, "SHORTCODE")
393-
c.Assert(p.Name(), qt.Equals, "p1.md")
394-
395-
th := newTestHelper(s.conf, s.Fs, t)
396-
397-
th.assertFileContent(filepath.FromSlash("public/s1/index.html"), "TheContent")
398-
th.assertFileContent(filepath.FromSlash("public/s1/l1.png"), "PNG")
399-
400-
th.assertFileNotExist("public/s2/index.html")
401-
// But the bundled resources needs to be published
402-
th.assertFileContent(filepath.FromSlash("public/s2/l1.png"), "PNG")
403-
404-
// No headless bundles here, please.
405-
// https://github.com/gohugoio/hugo/issues/6492
406-
c.Assert(s.RegularPages(), qt.HasLen, 1)
407-
c.Assert(s.Pages(), qt.HasLen, 4)
408-
c.Assert(s.home.RegularPages(), qt.HasLen, 1)
409-
c.Assert(s.home.Pages(), qt.HasLen, 1)
410-
}
411-
412320
func TestPageBundlerHeadlessIssue6552(t *testing.T) {
413321
t.Parallel()
414322

‎hugolib/rss_test.go‎

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -14,50 +14,9 @@
1414
package hugolib
1515

1616
import (
17-
"path/filepath"
18-
"strings"
1917
"testing"
20-
21-
"github.com/gohugoio/hugo/deps"
2218
)
2319

24-
func TestRSSOutput(t *testing.T) {
25-
t.Parallel()
26-
27-
rssLimit := len(weightedSources) - 1
28-
29-
cfg, fs := newTestCfg()
30-
cfg.Set("baseURL", "http://auth/bub/")
31-
cfg.Set("title", "RSSTest")
32-
cfg.Set("rssLimit", rssLimit)
33-
th, configs := newTestHelperFromProvider(cfg, fs, t)
34-
35-
rssURI := "index.xml"
36-
37-
for _, src := range weightedSources {
38-
writeSource(t, fs, filepath.Join("content", "sect", src[0]), src[1])
39-
}
40-
41-
buildSingleSite(t, deps.DepsCfg{Fs: fs, Configs: configs}, BuildCfg{})
42-
43-
// Home RSS
44-
th.assertFileContent(filepath.Join("public", rssURI), "<?xml", "rss version", "RSSTest")
45-
// Section RSS
46-
th.assertFileContent(filepath.Join("public", "sect", rssURI), "<?xml", "rss version", "Sects on RSSTest")
47-
// Taxonomy RSS
48-
th.assertFileContent(filepath.Join("public", "categories", "hugo", rssURI), "<?xml", "rss version", "Hugo on RSSTest")
49-
50-
// RSS Item Limit
51-
content := readWorkingDir(t, fs, filepath.Join("public", rssURI))
52-
c := strings.Count(content, "<item>")
53-
if c != rssLimit {
54-
t.Errorf("incorrect RSS item count: expected %d, got %d", rssLimit, c)
55-
}
56-
57-
// Encoded summary
58-
th.assertFileContent(filepath.Join("public", rssURI), "<?xml", "description", "A &lt;em&gt;custom&lt;/em&gt; summary")
59-
}
60-
6120
// Before Hugo 0.49 we set the pseudo page kind RSS on the page when output to RSS.
6221
// This had some unintended side effects, esp. when the only output format for that page
6322
// was RSS.

‎hugolib/site_output_test.go‎

Lines changed: 0 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ import (
2323
"github.com/gohugoio/hugo/config"
2424
"github.com/gohugoio/hugo/resources/kinds"
2525

26-
"github.com/spf13/afero"
27-
2826
"github.com/gohugoio/hugo/output"
2927
)
3028

@@ -216,119 +214,6 @@ Len Pages: {{ .Kind }} {{ len .Site.RegularPages }} Page Number: {{ .Paginator.P
216214
b.Assert(home.HasShortcode("doesNotExist"), qt.Equals, false)
217215
}
218216

219-
// Issue #3447
220-
func TestRedefineRSSOutputFormat(t *testing.T) {
221-
siteConfig := `
222-
baseURL = "http://example.com/blog"
223-
224-
defaultContentLanguage = "en"
225-
226-
disableKinds = ["page", "section", "term", "taxonomy", "sitemap", "robotsTXT", "404"]
227-
228-
[pagination]
229-
pagerSize = 1
230-
231-
[outputFormats]
232-
[outputFormats.RSS]
233-
mediatype = "application/rss"
234-
baseName = "feed"
235-
236-
`
237-
238-
c := qt.New(t)
239-
240-
mf := afero.NewMemMapFs()
241-
writeToFs(t, mf, "content/foo.html", `foo`)
242-
243-
th, h := newTestSitesFromConfig(t, mf, siteConfig)
244-
245-
err := h.Build(BuildCfg{})
246-
247-
c.Assert(err, qt.IsNil)
248-
249-
th.assertFileContent("public/feed.xml", "Recent content on")
250-
251-
s := h.Sites[0]
252-
253-
// Issue #3450
254-
c.Assert(s.Home().OutputFormats().Get("rss").Permalink(), qt.Equals, "http://example.com/blog/feed.xml")
255-
}
256-
257-
// Issue #3614
258-
func TestDotLessOutputFormat(t *testing.T) {
259-
siteConfig := `
260-
baseURL = "http://example.com/blog"
261-
262-
defaultContentLanguage = "en"
263-
264-
disableKinds = ["page", "section", "term", "taxonomy", "sitemap", "robotsTXT", "404"]
265-
266-
[pagination]
267-
pagerSize = 1
268-
269-
[mediaTypes]
270-
[mediaTypes."text/nodot"]
271-
delimiter = ""
272-
[mediaTypes."text/defaultdelim"]
273-
suffixes = ["defd"]
274-
[mediaTypes."text/nosuffix"]
275-
[mediaTypes."text/customdelim"]
276-
suffixes = ["del"]
277-
delimiter = "_"
278-
279-
[outputs]
280-
home = [ "DOTLESS", "DEF", "NOS", "CUS" ]
281-
282-
[outputFormats]
283-
[outputFormats.DOTLESS]
284-
mediatype = "text/nodot"
285-
baseName = "_redirects" # This is how Netlify names their redirect files.
286-
[outputFormats.DEF]
287-
mediatype = "text/defaultdelim"
288-
baseName = "defaultdelimbase"
289-
[outputFormats.NOS]
290-
mediatype = "text/nosuffix"
291-
baseName = "nosuffixbase"
292-
[outputFormats.CUS]
293-
mediatype = "text/customdelim"
294-
baseName = "customdelimbase"
295-
296-
`
297-
298-
c := qt.New(t)
299-
300-
mf := afero.NewMemMapFs()
301-
writeToFs(t, mf, "content/foo.html", `foo`)
302-
writeToFs(t, mf, "layouts/_default/list.dotless", `a dotless`)
303-
writeToFs(t, mf, "layouts/_default/list.def.defd", `default delimim`)
304-
writeToFs(t, mf, "layouts/_default/list.nos", `no suffix`)
305-
writeToFs(t, mf, "layouts/_default/list.cus.del", `custom delim`)
306-
307-
th, h := newTestSitesFromConfig(t, mf, siteConfig)
308-
309-
err := h.Build(BuildCfg{})
310-
311-
c.Assert(err, qt.IsNil)
312-
313-
s := h.Sites[0]
314-
315-
th.assertFileContent("public/_redirects", "a dotless")
316-
th.assertFileContent("public/defaultdelimbase.defd", "default delimim")
317-
// This looks weird, but the user has chosen this definition.
318-
th.assertFileContent("public/nosuffixbase", "no suffix")
319-
th.assertFileContent("public/customdelimbase_del", "custom delim")
320-
321-
home := s.getPageOldVersion(kinds.KindHome)
322-
c.Assert(home, qt.Not(qt.IsNil))
323-
324-
outputs := home.OutputFormats()
325-
326-
c.Assert(outputs.Get("DOTLESS").RelPermalink(), qt.Equals, "/blog/_redirects")
327-
c.Assert(outputs.Get("DEF").RelPermalink(), qt.Equals, "/blog/defaultdelimbase.defd")
328-
c.Assert(outputs.Get("NOS").RelPermalink(), qt.Equals, "/blog/nosuffixbase")
329-
c.Assert(outputs.Get("CUS").RelPermalink(), qt.Equals, "/blog/customdelimbase_del")
330-
}
331-
332217
// Issue 8030
333218
func TestGetOutputFormatRel(t *testing.T) {
334219
b := newTestSitesBuilder(t).

0 commit comments

Comments
 (0)