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
1182eb18
Commit
1182eb18
authored
Apr 04, 2017
by
Yegor
Committed by
GitHub
Apr 04, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add "flaky" and "timeout_in_minutes" devicelab task options (#9168)
parent
93126a85
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
3 deletions
+84
-3
manifest.dart
dev/devicelab/lib/framework/manifest.dart
+26
-1
manifest_test.dart
dev/devicelab/test/manifest_test.dart
+58
-2
No files found.
dev/devicelab/lib/framework/manifest.dart
View file @
1182eb18
...
...
@@ -32,6 +32,8 @@ class ManifestTask {
@required
this
.
description
,
@required
this
.
stage
,
@required
this
.
requiredAgentCapabilities
,
@required
this
.
isFlaky
,
@required
this
.
timeoutInMinutes
,
})
{
final
String
taskName
=
'task "
$name
"'
;
_checkIsNotBlank
(
name
,
'Task name'
,
taskName
);
...
...
@@ -51,6 +53,14 @@ class ManifestTask {
/// Capabilities required of the build agent to be able to perform this task.
final
List
<
String
>
requiredAgentCapabilities
;
/// Whether this test is flaky.
///
/// Flaky tests are not considered when deciding if the build is broken.
final
bool
isFlaky
;
/// An optional custom timeout specified in minutes.
final
int
timeoutInMinutes
;
}
/// Thrown when the manifest YAML is not valid.
...
...
@@ -72,7 +82,8 @@ Manifest _validateAndParseManifest(Map<String, dynamic> manifestYaml) {
List
<
ManifestTask
>
_validateAndParseTasks
(
dynamic
tasksYaml
)
{
_checkType
(
tasksYaml
is
Map
,
tasksYaml
,
'Value of "tasks"'
,
'dictionary'
);
return
tasksYaml
.
keys
.
map
((
dynamic
taskName
)
=>
_validateAndParseTask
(
taskName
,
tasksYaml
[
taskName
])).
toList
();
final
List
<
String
>
sortedKeys
=
tasksYaml
.
keys
.
toList
()..
sort
();
return
sortedKeys
.
map
((
dynamic
taskName
)
=>
_validateAndParseTask
(
taskName
,
tasksYaml
[
taskName
])).
toList
();
}
ManifestTask
_validateAndParseTask
(
dynamic
taskName
,
dynamic
taskYaml
)
{
...
...
@@ -82,14 +93,28 @@ ManifestTask _validateAndParseTask(dynamic taskName, dynamic taskYaml) {
'description'
,
'stage'
,
'required_agent_capabilities'
,
'flaky'
,
'timeout_in_minutes'
,
]);
final
dynamic
isFlaky
=
taskYaml
[
'flaky'
];
if
(
isFlaky
!=
null
)
{
_checkType
(
isFlaky
is
bool
,
isFlaky
,
'flaky'
,
'boolean'
);
}
final
dynamic
timeoutInMinutes
=
taskYaml
[
'timeout_in_minutes'
];
if
(
timeoutInMinutes
!=
null
)
{
_checkType
(
timeoutInMinutes
is
int
,
timeoutInMinutes
,
'timeout_in_minutes'
,
'integer'
);
}
final
List
<
String
>
capabilities
=
_validateAndParseCapabilities
(
taskName
,
taskYaml
[
'required_agent_capabilities'
]);
return
new
ManifestTask
.
_
(
name:
taskName
,
description:
taskYaml
[
'description'
],
stage:
taskYaml
[
'stage'
],
requiredAgentCapabilities:
capabilities
,
isFlaky:
isFlaky
??
false
,
timeoutInMinutes:
timeoutInMinutes
,
);
}
...
...
dev/devicelab/test/manifest_test.dart
View file @
1182eb18
...
...
@@ -34,6 +34,22 @@ void main() {
});
}
test
(
'accepts task with minimum amount of configuration'
,
()
{
final
Manifest
manifest
=
loadTaskManifest
(
'''
tasks:
minimum_configuration_task:
description: Description is mandatory.
stage: stage_is_mandatory_too
required_agent_capabilities: ["so-is-capability"]
'''
);
expect
(
manifest
.
tasks
.
single
.
description
,
'Description is mandatory.'
);
expect
(
manifest
.
tasks
.
single
.
stage
,
'stage_is_mandatory_too'
);
expect
(
manifest
.
tasks
.
single
.
requiredAgentCapabilities
,
<
String
>[
'so-is-capability'
]);
expect
(
manifest
.
tasks
.
single
.
isFlaky
,
false
);
expect
(
manifest
.
tasks
.
single
.
timeoutInMinutes
,
null
);
});
testManifestError
(
'invalid top-level type'
,
'Manifest must be a dictionary but was YamlScalar: null'
,
...
...
@@ -79,7 +95,7 @@ void main() {
testManifestError
(
'invalid task property'
,
'Unrecognized property "bar" in Value of task "foo". Allowed properties: description, stage, required_agent_capabilities'
,
'Unrecognized property "bar" in Value of task "foo". Allowed properties: description, stage, required_agent_capabilities
, flaky, timeout_in_minutes
'
,
'''
tasks:
foo:
...
...
@@ -129,7 +145,7 @@ void main() {
);
testManifestError
(
'missing
stage
'
,
'missing
required_agent_capabilities
'
,
'requiredAgentCapabilities must not be empty in task "foo".'
,
'''
tasks:
...
...
@@ -139,5 +155,45 @@ void main() {
required_agent_capabilities: []
'''
);
testManifestError
(
'bad flaky type'
,
'flaky must be a boolean but was String: not-a-boolean'
,
'''
tasks:
foo:
description: b
stage: c
required_agent_capabilities: ["a"]
flaky: not-a-boolean
'''
);
test
(
'accepts boolean flaky option'
,
()
{
final
Manifest
manifest
=
loadTaskManifest
(
'''
tasks:
flaky_task:
description: d
stage: s
required_agent_capabilities: ["c"]
flaky: true
'''
);
expect
(
manifest
.
tasks
.
single
.
name
,
'flaky_task'
);
expect
(
manifest
.
tasks
.
single
.
isFlaky
,
isTrue
);
});
test
(
'accepts custom timeout_in_minutes option'
,
()
{
final
Manifest
manifest
=
loadTaskManifest
(
'''
tasks:
task_with_custom_timeout:
description: d
stage: s
required_agent_capabilities: ["c"]
timeout_in_minutes: 120
'''
);
expect
(
manifest
.
tasks
.
single
.
timeoutInMinutes
,
120
);
});
});
}
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