diff options
author | Bjørn Erik Pedersen <[email protected]> | 2022-06-30 12:36:55 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2022-06-30 12:36:55 +0200 |
commit | 72b0ccdb010fcdfeb3bb4a955d4fc04529816c0d (patch) | |
tree | 4eeeeda2a13f7a2b97227e0180c0e7133f08260e | |
parent | 65e52a7f5c79e6cfeabafa67d1bff4994c7fc4a4 (diff) | |
download | hugo-72b0ccdb010fcdfeb3bb4a955d4fc04529816c0d.tar.gz hugo-72b0ccdb010fcdfeb3bb4a955d4fc04529816c0d.zip |
Make the baseline benchmark's test files stable
And add some assertions.
-rw-r--r-- | hugolib/hugo_smoke_test.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/hugolib/hugo_smoke_test.go b/hugolib/hugo_smoke_test.go index 0c14414e5..62bece032 100644 --- a/hugolib/hugo_smoke_test.go +++ b/hugolib/hugo_smoke_test.go @@ -331,6 +331,10 @@ func TestBenchmarkBaseline(t *testing.T) { b := NewIntegrationTestBuilder(cfg).Build() 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 { + + rnd := rand.New(rand.NewSource(32)) + files := ` -- config.toml -- 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"} { n := i + j + 1 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 files += fmt.Sprintf("\n-- content/%s/%s/%s/p%d.md --\n"+contentTemplate, lang, root, section, n, n, n) } |