-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs-only changes do not require a changelog entry, as we reserve the changelog for changes to the product. Edit the changelog workflow to ignore docs-only changes.
- Loading branch information
Showing
2 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,81 @@ func TestChangelog(t *testing.T) { | |
}) | ||
} | ||
|
||
func TestMissingNoChangelogLabel(t *testing.T) { | ||
tests := []struct { | ||
description string | ||
files github.PullRequestFiles | ||
expectPass bool | ||
}{ | ||
{ | ||
description: "empty file set", | ||
files: github.PullRequestFiles{}, | ||
expectPass: false, | ||
}, | ||
{ | ||
description: "code and docs", | ||
files: github.PullRequestFiles{ | ||
{ | ||
Name: "lib/service/service.go", | ||
}, | ||
{ | ||
Name: "docs/pages/index.mdx", | ||
}, | ||
}, | ||
expectPass: false, | ||
}, | ||
{ | ||
description: "code only", | ||
files: github.PullRequestFiles{ | ||
{ | ||
Name: "lib/service/service.go", | ||
}, | ||
}, | ||
expectPass: false, | ||
}, | ||
{ | ||
description: "docs only", | ||
files: github.PullRequestFiles{ | ||
{ | ||
Name: "docs/pages/index.mdx", | ||
}, | ||
}, | ||
expectPass: true, | ||
}, | ||
} | ||
|
||
for _, c := range tests { | ||
t.Run(c.description, func(t *testing.T) { | ||
b := &Bot{ | ||
c: &Config{ | ||
Environment: &env.Environment{ | ||
// Assumes the Teleport repository, | ||
// where we keep our documentation | ||
// content. | ||
Organization: "gravitaional", | ||
Repository: "teleport", | ||
Number: 0, | ||
Author: "9", | ||
UnsafeBase: "branch/v8", | ||
UnsafeHead: "fix", | ||
}, | ||
GitHub: &fakeGithub{ | ||
comments: []github.Comment{ | ||
{ | ||
Author: "[email protected]", | ||
Body: "PR comment body", | ||
}, | ||
}, | ||
files: c.files, | ||
}, | ||
}, | ||
} | ||
err := b.CheckChangelog(context.Background()) | ||
require.Equal(t, c.expectPass, err == nil) | ||
}) | ||
} | ||
} | ||
|
||
func TestGetChangelogEntry(t *testing.T) { | ||
tests := []struct { | ||
desc string | ||
|