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
2adb1fc0
Unverified
Commit
2adb1fc0
authored
Apr 10, 2020
by
Christopher Fujino
Committed by
GitHub
Apr 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix environment leakage in doctor_test (#54478)
parent
d081364d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
6 deletions
+25
-6
doctor_test.dart
...utter_tools/test/commands.shard/hermetic/doctor_test.dart
+25
-6
No files found.
packages/flutter_tools/test/commands.shard/hermetic/doctor_test.dart
View file @
2adb1fc0
...
@@ -365,6 +365,16 @@ void main() {
...
@@ -365,6 +365,16 @@ void main() {
});
});
group
(
'doctor with fake validators'
,
()
{
group
(
'doctor with fake validators'
,
()
{
MockArtifacts
mockArtifacts
;
const
String
genSnapshotPath
=
'/path/to/gen_snapshot'
;
FileSystem
memoryFileSystem
;
setUp
(()
{
memoryFileSystem
=
MemoryFileSystem
.
test
();
mockArtifacts
=
MockArtifacts
();
when
(
mockArtifacts
.
getArtifactPath
(
Artifact
.
genSnapshot
)).
thenReturn
(
genSnapshotPath
);
});
testUsingContext
(
'validate non-verbose output format for run without issues'
,
()
async
{
testUsingContext
(
'validate non-verbose output format for run without issues'
,
()
async
{
expect
(
await
FakeQuietDoctor
().
diagnose
(
verbose:
false
),
isTrue
);
expect
(
await
FakeQuietDoctor
().
diagnose
(
verbose:
false
),
isTrue
);
expect
(
testLogger
.
statusText
,
equals
(
expect
(
testLogger
.
statusText
,
equals
(
...
@@ -507,8 +517,9 @@ void main() {
...
@@ -507,8 +517,9 @@ void main() {
},
overrides:
noColorTerminalOverride
);
},
overrides:
noColorTerminalOverride
);
testUsingContext
(
'gen_snapshot does not work'
,
()
async
{
testUsingContext
(
'gen_snapshot does not work'
,
()
async
{
memoryFileSystem
.
file
(
genSnapshotPath
).
createSync
(
recursive:
true
);
when
(
mockProcessManager
.
runSync
(
when
(
mockProcessManager
.
runSync
(
<
String
>[
g
lobals
.
artifacts
.
getArtifactPath
(
Artifact
.
genSnapshot
)
],
<
String
>[
g
enSnapshotPath
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
ProcessResult
(
101
,
1
,
''
,
''
));
)).
thenReturn
(
ProcessResult
(
101
,
1
,
''
,
''
));
...
@@ -524,22 +535,26 @@ void main() {
...
@@ -524,22 +535,26 @@ void main() {
}
}
}
}
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
mockArtifacts
,
FileSystem:
()
=>
memoryFileSystem
,
OutputPreferences:
()
=>
OutputPreferences
(
wrapText:
false
),
OutputPreferences:
()
=>
OutputPreferences
(
wrapText:
false
),
ProcessManager:
()
=>
mockProcessManager
,
ProcessManager:
()
=>
mockProcessManager
,
Platform:
_kNoColorOutputPlatform
,
Platform:
_kNoColorOutputPlatform
,
});
});
testUsingContext
(
'gen_snapshot binary not available'
,
()
async
{
testUsingContext
(
'gen_snapshot binary not available'
,
()
async
{
expect
(
await
FlutterValidatorDoctor
().
diagnose
(
verbose:
false
),
isTrue
);
expect
(
await
FlutterValidatorDoctor
().
diagnose
(
verbose:
false
),
isTrue
);
// gen_snapshot is downloaded on demand, and the doctor should not
// gen_snapshot is downloaded on demand, and the doctor should not
// fail if the gen_snapshot binary is not present.
// fail if the gen_snapshot binary is not present.
expect
(
testLogger
.
statusText
,
contains
(
'No issues found!'
));
expect
(
testLogger
.
statusText
,
contains
(
'No issues found!'
));
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
mockArtifacts
,
FileSystem:
()
=>
MemoryFileSystem
(),
FileSystem:
()
=>
MemoryFileSystem
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
});
testUsingContext
(
'version checking does not work'
,
()
async
{
testUsingContext
(
'version checking does not work'
,
()
async
{
memoryFileSystem
.
file
(
genSnapshotPath
).
createSync
(
recursive:
true
);
final
VersionCheckError
versionCheckError
=
VersionCheckError
(
'version error'
);
final
VersionCheckError
versionCheckError
=
VersionCheckError
(
'version error'
);
when
(
mockFlutterVersion
.
channel
).
thenReturn
(
'unknown'
);
when
(
mockFlutterVersion
.
channel
).
thenReturn
(
'unknown'
);
...
@@ -547,7 +562,7 @@ void main() {
...
@@ -547,7 +562,7 @@ void main() {
when
(
mockFlutterVersion
.
frameworkDate
).
thenThrow
(
versionCheckError
);
when
(
mockFlutterVersion
.
frameworkDate
).
thenThrow
(
versionCheckError
);
when
(
mockProcessManager
.
runSync
(
when
(
mockProcessManager
.
runSync
(
<
String
>[
g
lobals
.
artifacts
.
getArtifactPath
(
Artifact
.
genSnapshot
)
],
<
String
>[
g
enSnapshotPath
],
workingDirectory:
anyNamed
(
'workingDirectory'
),
workingDirectory:
anyNamed
(
'workingDirectory'
),
environment:
anyNamed
(
'environment'
),
environment:
anyNamed
(
'environment'
),
)).
thenReturn
(
ProcessResult
(
101
,
255
,
''
,
''
));
)).
thenReturn
(
ProcessResult
(
101
,
255
,
''
,
''
));
...
@@ -561,6 +576,8 @@ void main() {
...
@@ -561,6 +576,8 @@ void main() {
'! Doctor found issues in 1 category.
\n
'
'! Doctor found issues in 1 category.
\n
'
));
));
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
Artifacts:
()
=>
mockArtifacts
,
FileSystem:
()
=>
memoryFileSystem
,
OutputPreferences:
()
=>
OutputPreferences
(
wrapText:
false
),
OutputPreferences:
()
=>
OutputPreferences
(
wrapText:
false
),
ProcessManager:
()
=>
mockProcessManager
,
ProcessManager:
()
=>
mockProcessManager
,
Platform:
_kNoColorOutputPlatform
,
Platform:
_kNoColorOutputPlatform
,
...
@@ -736,6 +753,7 @@ void main() {
...
@@ -736,6 +753,7 @@ void main() {
contains
(
isA
<
WebWorkflow
>()));
contains
(
isA
<
WebWorkflow
>()));
},
overrides:
<
Type
,
Generator
>{
},
overrides:
<
Type
,
Generator
>{
FeatureFlags:
()
=>
TestFeatureFlags
(
isWebEnabled:
true
),
FeatureFlags:
()
=>
TestFeatureFlags
(
isWebEnabled:
true
),
FileSystem:
()
=>
MemoryFileSystem
.
test
(),
ProcessManager:
()
=>
MockProcessManager
(),
ProcessManager:
()
=>
MockProcessManager
(),
});
});
...
@@ -1122,3 +1140,4 @@ class VsCodeValidatorTestTargets extends VsCodeValidator {
...
@@ -1122,3 +1140,4 @@ class VsCodeValidatorTestTargets extends VsCodeValidator {
}
}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
class
MockProcessManager
extends
Mock
implements
ProcessManager
{}
class
MockArtifacts
extends
Mock
implements
Artifacts
{}
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