-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[flutter_plugin_tool] Fix CHANGELOG validation failure summary #4266
[flutter_plugin_tool] Fix CHANGELOG validation failure summary #4266
Conversation
The error summary for a CHANGELOG validation failure was written when the only thing being checked was that the versions matched, but now there are other ways to fail as well (i.e., leaving NEXT). This fixes the summary message to be more generic so that it doesn't mislead people who hit validation failures. While adding the test for this message, I discovered that almost all of the tests were actually talking to pub.dev, causing their behavior to in some cases depend on whether a package with that name happened to have been published, and if so what its version was. In order to make the tests hermetic and predictable, this fixes that by making all tests use a mock HTTP client.
cyanglaz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM % nits
| if (!(await _validateChangelogVersion(package, | ||
| pubspec: pubspec, pubspecVersionChanged: versionChanged))) { | ||
| errors.add('pubspec.yaml and CHANGELOG.md have different versions'); | ||
| errors.add('CHANGELOG.md failed validation.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a place to explain what are the failing scenarios? If not, maybe we should list them here so it's easier for debugging. (Especially when none-team-member contributor hits this error)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The specific error is output inline, this is just the line that goes in the final summary. The summary block always says to see the full log for details. See https://cirrus-ci.com/task/4541043946291200 for an example (that led to this PR).
| fileSystem = MemoryFileSystem(); | ||
| mockPlatform = MockPlatform(); | ||
| packagesDir = createPackagesDirectory(fileSystem: fileSystem); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nits: extra line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this on purpose; the next section is a big block of setup for the mock GitDir and having it separated out slightly makes it easier to see the high-level flow vs it being a wall of text.
(I'll likely replace the git setup here with something based on processRunner like I did with the new publish tests, which would help, but didn't want to get into that in this PR.)
…er#4266) The error summary for a CHANGELOG validation failure was written when the only thing being checked was that the versions matched, but now there are other ways to fail as well (i.e., leaving NEXT). This fixes the summary message to be more generic so that it doesn't mislead people who hit validation failures. While adding the test for this message, I discovered that almost all of the tests were actually talking to pub.dev, causing their behavior to in some cases depend on whether a package with that name happened to have been published, and if so what its version was. In order to make the tests hermetic and predictable, this fixes that by making all tests use a mock HTTP client.
…er#4266) The error summary for a CHANGELOG validation failure was written when the only thing being checked was that the versions matched, but now there are other ways to fail as well (i.e., leaving NEXT). This fixes the summary message to be more generic so that it doesn't mislead people who hit validation failures. While adding the test for this message, I discovered that almost all of the tests were actually talking to pub.dev, causing their behavior to in some cases depend on whether a package with that name happened to have been published, and if so what its version was. In order to make the tests hermetic and predictable, this fixes that by making all tests use a mock HTTP client.
The error summary for a CHANGELOG validation failure was written when
the only thing being checked was that the versions matched, but now
there are other ways to fail as well (i.e., leaving NEXT). This fixes
the summary message to be more generic so that it doesn't mislead people
who hit validation failures.
While adding the test for this message, I discovered that almost all of
the tests were actually talking to pub.dev, causing their behavior to in
some cases depend on whether a package with that name happened to have
been published, and if so what its version was. In order to make the
tests hermetic and predictable, this fixes that by making all tests use
a mock HTTP client.
Pre-launch Checklist
dart format.)[shared_preferences]///).