Skip to content

Commit 72b0ccd

Browse files
committed
Make the baseline benchmark's test files stable
And add some assertions.
1 parent 65e52a7 commit 72b0ccd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

‎hugolib/hugo_smoke_test.go‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,10 @@ func TestBenchmarkBaseline(t *testing.T) {
331331
b := NewIntegrationTestBuilder(cfg).Build()
332332

333333
b.Assert(len(b.H.Sites), qt.Equals, 4)
334+
b.Assert(len(b.H.Sites[0].RegularPages()), qt.Equals, 161)
335+
b.Assert(len(b.H.Sites[0].Pages()), qt.Equals, 197)
336+
b.Assert(len(b.H.Sites[2].RegularPages()), qt.Equals, 158)
337+
b.Assert(len(b.H.Sites[2].Pages()), qt.Equals, 194)
334338

335339
}
336340

@@ -352,6 +356,9 @@ func BenchmarkBaseline(b *testing.B) {
352356
}
353357

354358
func benchmarkBaselineFiles() string {
359+
360+
rnd := rand.New(rand.NewSource(32))
361+
355362
files := `
356363
-- config.toml --
357364
baseURL = "https://example.com"
@@ -431,7 +438,7 @@ Aliqua labore enim et sint anim amet excepteur ea dolore.
431438
for j, section := range []string{"posts", "posts/funny", "posts/science", "posts/politics", "posts/world", "posts/technology", "posts/world/news", "posts/world/news/europe"} {
432439
n := i + j + 1
433440
files += fmt.Sprintf("\n-- content/%s/%s/%s/_index.md --\n"+contentTemplate, lang, root, section, n, n, n)
434-
for k := 1; k < rand.Intn(30)+1; k++ {
441+
for k := 1; k < rnd.Intn(30)+1; k++ {
435442
n := n + k
436443
files += fmt.Sprintf("\n-- content/%s/%s/%s/p%d.md --\n"+contentTemplate, lang, root, section, n, n, n)
437444
}

0 commit comments

Comments
 (0)