Skip to content

Commit dda50da

Browse files
Add test coverage for new comment in frontmatter
1 parent 1ffc289 commit dda50da

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

pkg/tfgen/installation_docs.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,8 @@ func plainDocsParser(docFile *DocFile, g *Generator) ([]byte, error) {
5353
// Determine if we should write an overview header.
5454
overviewHeader := getOverviewHeader(content)
5555

56-
autoGenMessage := fmt.Sprint(
57-
"<!-- *** WARNING: This file was auto-generated. " +
58-
"Do not edit by hand unless you're certain you know what you are doing! *** -->\n")
59-
6056
// Add instructions to top of file
61-
contentStr := frontMatter + autoGenMessage + installationInstructions + overviewHeader + string(content)
57+
contentStr := frontMatter + installationInstructions + overviewHeader + string(content)
6258

6359
//Translate code blocks to Pulumi
6460
contentStr, err = translateCodeBlocks(contentStr, g)
@@ -86,8 +82,9 @@ func writeFrontMatter(providerName string) string {
8682
// Capitalize the package name
8783
capitalize := cases.Title(language.English)
8884
title := capitalize.String(providerName)
89-
9085
return fmt.Sprintf(delimiter+
86+
"# *** WARNING: This file was auto-generated. "+
87+
"Do not edit by hand unless you're certain you know what you are doing! ***\n"+
9188
"title: %[1]s Provider\n"+
9289
"meta_desc: Provides an overview on how to configure the Pulumi %[1]s provider.\n"+
9390
"layout: package\n"+

pkg/tfgen/installation_docs_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@ func TestWriteFrontMatter(t *testing.T) {
272272
name: "Generates Front Matter for installation-configuration.md",
273273
providerName: "test",
274274
expected: delimiter +
275+
"# *** WARNING: This file was auto-generated. " +
276+
"Do not edit by hand unless you're certain you know what you are doing! ***\n" +
275277
"title: Test Provider\n" +
276278
"meta_desc: Provides an overview on how to configure the Pulumi Test provider.\n" +
277279
"layout: package\n" +

pkg/tfgen/test_data/convert-index-file-edit-rules/expected.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
# *** WARNING: This file was auto-generated. Do not edit by hand unless you're certain you know what you are doing! ***
23
title: Libvirt Provider
34
meta_desc: Provides an overview on how to configure the Pulumi Libvirt provider.
45
layout: package

pkg/tfgen/test_data/convert-index-file/expected.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
# *** WARNING: This file was auto-generated. Do not edit by hand unless you're certain you know what you are doing! ***
23
title: Libvirt Provider
34
meta_desc: Provides an overview on how to configure the Pulumi Libvirt provider.
45
layout: package

0 commit comments

Comments
 (0)