Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
ea520138
Unverified
Commit
ea520138
authored
Nov 15, 2021
by
Kate Lovett
Committed by
GitHub
Nov 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Close tree if unapproved golden images get in (#93516)
parent
0a2227c2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
6 deletions
+56
-6
flutter_goldens_test.dart
packages/flutter_goldens/test/flutter_goldens_test.dart
+39
-0
skia_client.dart
packages/flutter_goldens_client/lib/skia_client.dart
+17
-6
No files found.
packages/flutter_goldens/test/flutter_goldens_test.dart
View file @
ea520138
...
@@ -153,6 +153,45 @@ void main() {
...
@@ -153,6 +153,45 @@ void main() {
);
);
});
});
test
(
'throws for error state from imgtestAdd'
,
()
{
final
File
goldenFile
=
fs
.
file
(
'/workDirectory/temp/golden_file_test.png'
)
..
createSync
(
recursive:
true
);
platform
=
FakePlatform
(
environment:
<
String
,
String
>{
'FLUTTER_ROOT'
:
_kFlutterRoot
,
'GOLDCTL'
:
'goldctl'
,
},
operatingSystem:
'macos'
);
skiaClient
=
SkiaGoldClient
(
workDirectory
,
fs:
fs
,
process:
process
,
platform:
platform
,
httpClient:
fakeHttpClient
,
);
process
.
fallbackProcessResult
=
ProcessResult
(
123
,
1
,
'fail'
,
'fail'
);
const
RunInvocation
goldctlInvocation
=
RunInvocation
(
<
String
>[
'goldctl'
,
'imgtest'
,
'add'
,
'--work-dir'
,
'/workDirectory/temp'
,
'--test-name'
,
'golden_file_test'
,
'--png-file'
,
'/workDirectory/temp/golden_file_test.png'
,
'--passfail'
,
],
null
,
);
process
.
processResults
[
goldctlInvocation
]
=
ProcessResult
(
123
,
1
,
'fail'
,
'fail'
);
expect
(
skiaClient
.
imgtestAdd
(
'golden_file_test'
,
goldenFile
),
throwsException
,
);
});
test
(
'correctly inits tryjob for luci'
,
()
async
{
test
(
'correctly inits tryjob for luci'
,
()
async
{
platform
=
FakePlatform
(
platform
=
FakePlatform
(
environment:
<
String
,
String
>{
environment:
<
String
,
String
>{
...
...
packages/flutter_goldens_client/lib/skia_client.dart
View file @
ea520138
...
@@ -177,17 +177,28 @@ class SkiaGoldClient {
...
@@ -177,17 +177,28 @@ class SkiaGoldClient {
.
path
,
.
path
,
'--test-name'
,
cleanTestName
(
testName
),
'--test-name'
,
cleanTestName
(
testName
),
'--png-file'
,
goldenFile
.
path
,
'--png-file'
,
goldenFile
.
path
,
'--passfail'
,
];
];
final
io
.
ProcessResult
result
=
await
process
.
run
(
imgtestCommand
);
final
io
.
ProcessResult
result
=
await
process
.
run
(
imgtestCommand
);
if
(
result
.
exitCode
!=
0
)
{
if
(
result
.
exitCode
!=
0
)
{
// We do not want to throw for non-zero exit codes here, as an intentional
// If an unapproved image has made it to post-submit, throw to close the
// change or new golden file test expect non-zero exit codes. Logging here
// tree.
// is meant to help debugging in CI when an unexpected result occurs.
final
StringBuffer
buf
=
StringBuffer
()
// See also: https://github.com/flutter/flutter/issues/91285
..
writeln
(
'Skia Gold received an unapproved image in post-submit '
)
print
(
'goldctl imgtest add stdout:
${result.stdout}
'
);
// ignore: avoid_print
..
writeln
(
'testing. Golden file images in flutter/flutter are triaged '
)
print
(
'goldctl imgtest add stderr:
${result.stderr}
'
);
// ignore: avoid_print
..
writeln
(
'in pre-submit during code review for the given PR.'
)
..
writeln
()
..
writeln
(
'Visit https://flutter-gold.skia.org/ to view and approve '
)
..
writeln
(
'the image(s), or revert the associated change. For more '
)
..
writeln
(
'information, visit the wiki: '
)
..
writeln
(
'https://github.com/flutter/flutter/wiki/Writing-a-golden-file-test-for-package:flutter'
)
..
writeln
()
..
writeln
(
'Debug information for Gold:'
)
..
writeln
(
'stdout:
${result.stdout}
'
)
..
writeln
(
'stderr:
${result.stderr}
'
);
throw
Exception
(
buf
.
toString
());
}
}
return
true
;
return
true
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment