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
1c15cd86
Unverified
Commit
1c15cd86
authored
Feb 05, 2020
by
Kate Lovett
Committed by
GitHub
Feb 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Gold flake from gsutil fallback (#50149)
parent
05eae425
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
16 deletions
+63
-16
animation_controller.dart
packages/flutter/lib/src/animation/animation_controller.dart
+2
-1
flutter_goldens.dart
packages/flutter_goldens/lib/flutter_goldens.dart
+24
-9
flutter_goldens_test.dart
packages/flutter_goldens/test/flutter_goldens_test.dart
+15
-3
json_templates.dart
packages/flutter_goldens/test/json_templates.dart
+13
-0
skia_client.dart
packages/flutter_goldens_client/lib/skia_client.dart
+9
-3
No files found.
packages/flutter/lib/src/animation/animation_controller.dart
View file @
1c15cd86
...
...
@@ -341,7 +341,8 @@ class AnimationController extends Animation<double>
/// Stops the animation controller and sets the current value of the
/// animation.
///
/// The new value is clamped to the range set by [lowerBound] and [upperBound].
/// The new value is clamped to the range set by [lowerBound] and
/// [upperBound].
///
/// Value listeners are notified even if this does not change the value.
/// Status listeners are notified if the animation was previously playing.
...
...
packages/flutter_goldens/lib/flutter_goldens.dart
View file @
1c15cd86
...
...
@@ -136,17 +136,31 @@ abstract class FlutterGoldenFileComparator extends GoldenFileComparator {
/// maintain thread safety while using the `goldctl` tool.
@protected
@visibleForTesting
static
Directory
getBaseDirectory
(
LocalFileComparator
defaultComparator
,
Platform
platform
,
{
String
suffix
=
''
})
{
static
Directory
getBaseDirectory
(
LocalFileComparator
defaultComparator
,
Platform
platform
,
{
String
suffix
=
''
,
bool
local
=
false
,
})
{
const
FileSystem
fs
=
LocalFileSystem
();
final
Directory
flutterRoot
=
fs
.
directory
(
platform
.
environment
[
_kFlutterRootKey
]);
final
Directory
comparisonRoot
=
flutterRoot
.
childDirectory
(
fs
.
path
.
join
(
'bin'
,
'cache'
,
'pkg'
,
'skia_goldens
$suffix
'
,
)
);
Directory
comparisonRoot
;
if
(!
local
)
{
comparisonRoot
=
fs
.
systemTempDirectory
.
childDirectory
(
'skia_goldens
$suffix
'
);
}
else
{
comparisonRoot
=
flutterRoot
.
childDirectory
(
fs
.
path
.
join
(
'bin'
,
'cache'
,
'pkg'
,
'skia_goldens'
,
)
);
}
final
Directory
testDirectory
=
fs
.
directory
(
defaultComparator
.
basedir
);
final
String
testDirectoryRelativePath
=
fs
.
path
.
relative
(
testDirectory
.
path
,
...
...
@@ -550,6 +564,7 @@ class FlutterLocalFileComparator extends FlutterGoldenFileComparator with LocalC
baseDirectory
??=
FlutterGoldenFileComparator
.
getBaseDirectory
(
defaultComparator
,
platform
,
local:
true
,
);
if
(!
baseDirectory
.
existsSync
())
{
...
...
packages/flutter_goldens/test/flutter_goldens_test.dart
View file @
1c15cd86
...
...
@@ -68,8 +68,9 @@ void main() {
});
test
(
'auth performs minimal work if already authorized'
,
()
async
{
fs
.
file
(
'/workDirectory/temp/auth_opt.json'
)
f
inal
File
authFile
=
f
s
.
file
(
'/workDirectory/temp/auth_opt.json'
)
..
createSync
(
recursive:
true
);
authFile
.
writeAsStringSync
(
authTemplate
());
when
(
process
.
run
(
any
))
.
thenAnswer
((
_
)
=>
Future
<
ProcessResult
>
.
value
(
ProcessResult
(
123
,
0
,
''
,
''
)));
...
...
@@ -81,6 +82,16 @@ void main() {
));
});
test
(
'gsutil is checked when authorization file is present'
,
()
async
{
final
File
authFile
=
fs
.
file
(
'/workDirectory/temp/auth_opt.json'
)
..
createSync
(
recursive:
true
);
authFile
.
writeAsStringSync
(
authTemplate
(
gsutil:
true
));
expect
(
await
skiaClient
.
clientIsAuthorized
(),
isFalse
,
);
});
test
(
'throws for error state from auth'
,
()
async
{
platform
=
FakePlatform
(
environment:
<
String
,
String
>{
...
...
@@ -110,7 +121,7 @@ void main() {
);
});
test
(
'
throws for error state from init'
,
()
{
test
(
'throws for error state from init'
,
()
{
platform
=
FakePlatform
(
environment:
<
String
,
String
>{
'FLUTTER_ROOT'
:
_kFlutterRoot
,
...
...
@@ -458,7 +469,7 @@ void main() {
);
});
test
(
'calculates the basedir correctly from defaultComparator'
,
()
async
{
test
(
'calculates the basedir correctly from defaultComparator
for local testing
'
,
()
async
{
final
MockLocalFileComparator
defaultComparator
=
MockLocalFileComparator
();
final
Directory
flutterRoot
=
fs
.
directory
(
platform
.
environment
[
'FLUTTER_ROOT'
])
..
createSync
(
recursive:
true
);
...
...
@@ -467,6 +478,7 @@ void main() {
final
Directory
basedir
=
FlutterGoldenFileComparator
.
getBaseDirectory
(
defaultComparator
,
platform
,
local:
true
,
);
expect
(
basedir
.
uri
,
...
...
packages/flutter_goldens/test/json_templates.dart
View file @
1c15cd86
...
...
@@ -2,6 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/// JSON template for the contents of the auth_opt.json file created by goldctl.
String
authTemplate
(
{
bool
gsutil
=
false
,
})
{
return
'''
{
"Luci":false,
"ServiceAccount":"
${gsutil ? '' : '/packages/flutter/test/widgets/serviceAccount.json'}
",
"GSUtil":
$gsutil
}
'''
;
}
/// JSON response template for Skia Gold expectations request:
/// https://flutter-gold.skia.org/json/expectations/commit/HEAD
String
rawExpectationsTemplate
(
)
{
...
...
packages/flutter_goldens_client/lib/skia_client.dart
View file @
1c15cd86
...
...
@@ -98,7 +98,7 @@ class SkiaGoldClient {
/// will only be called once for each instance of
/// [FlutterSkiaGoldFileComparator].
Future
<
void
>
auth
()
async
{
if
(
_
clientIsAuthorized
())
if
(
await
clientIsAuthorized
())
return
;
if
(
_serviceAccount
.
isEmpty
)
{
...
...
@@ -604,12 +604,18 @@ class SkiaGoldClient {
/// Returns a boolean value to prevent the client from re-authorizing itself
/// for multiple tests.
bool
_clientIsAuthorized
()
{
Future
<
bool
>
clientIsAuthorized
()
async
{
final
File
authFile
=
workDirectory
?.
childFile
(
fs
.
path
.
join
(
'temp'
,
'auth_opt.json'
,
));
return
authFile
.
existsSync
();
if
(
await
authFile
.
exists
())
{
final
String
contents
=
await
authFile
.
readAsString
();
final
Map
<
String
,
dynamic
>
decoded
=
json
.
decode
(
contents
)
as
Map
<
String
,
dynamic
>;
return
!(
decoded
[
'GSUtil'
]
as
bool
);
}
return
false
;
}
}
...
...
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