mirror of
https://github.com/gohugoio/hugo.git
synced 2024-12-24 13:01:01 +00:00
Make the baseline benchmark's test files stable
And add some assertions.
This commit is contained in:
parent
65e52a7f5c
commit
72b0ccdb01
1 changed files with 8 additions and 1 deletions
|
@ -331,6 +331,10 @@ func TestBenchmarkBaseline(t *testing.T) {
|
||||||
b := NewIntegrationTestBuilder(cfg).Build()
|
b := NewIntegrationTestBuilder(cfg).Build()
|
||||||
|
|
||||||
b.Assert(len(b.H.Sites), qt.Equals, 4)
|
b.Assert(len(b.H.Sites), qt.Equals, 4)
|
||||||
|
b.Assert(len(b.H.Sites[0].RegularPages()), qt.Equals, 161)
|
||||||
|
b.Assert(len(b.H.Sites[0].Pages()), qt.Equals, 197)
|
||||||
|
b.Assert(len(b.H.Sites[2].RegularPages()), qt.Equals, 158)
|
||||||
|
b.Assert(len(b.H.Sites[2].Pages()), qt.Equals, 194)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,6 +356,9 @@ func BenchmarkBaseline(b *testing.B) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func benchmarkBaselineFiles() string {
|
func benchmarkBaselineFiles() string {
|
||||||
|
|
||||||
|
rnd := rand.New(rand.NewSource(32))
|
||||||
|
|
||||||
files := `
|
files := `
|
||||||
-- config.toml --
|
-- config.toml --
|
||||||
baseURL = "https://example.com"
|
baseURL = "https://example.com"
|
||||||
|
@ -431,7 +438,7 @@ Aliqua labore enim et sint anim amet excepteur ea dolore.
|
||||||
for j, section := range []string{"posts", "posts/funny", "posts/science", "posts/politics", "posts/world", "posts/technology", "posts/world/news", "posts/world/news/europe"} {
|
for j, section := range []string{"posts", "posts/funny", "posts/science", "posts/politics", "posts/world", "posts/technology", "posts/world/news", "posts/world/news/europe"} {
|
||||||
n := i + j + 1
|
n := i + j + 1
|
||||||
files += fmt.Sprintf("\n-- content/%s/%s/%s/_index.md --\n"+contentTemplate, lang, root, section, n, n, n)
|
files += fmt.Sprintf("\n-- content/%s/%s/%s/_index.md --\n"+contentTemplate, lang, root, section, n, n, n)
|
||||||
for k := 1; k < rand.Intn(30)+1; k++ {
|
for k := 1; k < rnd.Intn(30)+1; k++ {
|
||||||
n := n + k
|
n := n + k
|
||||||
files += fmt.Sprintf("\n-- content/%s/%s/%s/p%d.md --\n"+contentTemplate, lang, root, section, n, n, n)
|
files += fmt.Sprintf("\n-- content/%s/%s/%s/p%d.md --\n"+contentTemplate, lang, root, section, n, n, n)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue