skip staging update (#89137)
This commit is contained in:
@@ -132,7 +132,7 @@ void main() {
|
||||
'"ResultData":{},'
|
||||
'"BenchmarkScoreKeys":[]}';
|
||||
fs.file(resultsPath).writeAsStringSync(updateTaskJson);
|
||||
await cocoon.sendResultsPath(resultsPath: resultsPath);
|
||||
await cocoon.sendTaskStatus(resultsPath: resultsPath);
|
||||
});
|
||||
|
||||
test('uploads expected update task payload from results file', () async {
|
||||
@@ -154,7 +154,7 @@ void main() {
|
||||
'"ResultData":{"i":0.0,"j":0.0,"not_a_metric":"something"},'
|
||||
'"BenchmarkScoreKeys":["i","j"]}';
|
||||
fs.file(resultsPath).writeAsStringSync(updateTaskJson);
|
||||
await cocoon.sendResultsPath(resultsPath: resultsPath);
|
||||
await cocoon.sendTaskStatus(resultsPath: resultsPath);
|
||||
});
|
||||
|
||||
test('Verify retries for task result upload', () async {
|
||||
@@ -186,7 +186,7 @@ void main() {
|
||||
'"ResultData":{"i":0.0,"j":0.0,"not_a_metric":"something"},'
|
||||
'"BenchmarkScoreKeys":["i","j"]}';
|
||||
fs.file(resultsPath).writeAsStringSync(updateTaskJson);
|
||||
await cocoon.sendResultsPath(resultsPath: resultsPath);
|
||||
await cocoon.sendTaskStatus(resultsPath: resultsPath);
|
||||
});
|
||||
|
||||
test('Verify timeout and retry for task result upload', () async {
|
||||
@@ -221,7 +221,7 @@ void main() {
|
||||
'"ResultData":{"i":0.0,"j":0.0,"not_a_metric":"something"},'
|
||||
'"BenchmarkScoreKeys":["i","j"]}';
|
||||
fs.file(resultsPath).writeAsStringSync(updateTaskJson);
|
||||
await cocoon.sendResultsPath(resultsPath: resultsPath);
|
||||
await cocoon.sendTaskStatus(resultsPath: resultsPath);
|
||||
});
|
||||
|
||||
test('Verify timeout does not trigger for result upload', () async {
|
||||
@@ -256,7 +256,7 @@ void main() {
|
||||
'"ResultData":{"i":0.0,"j":0.0,"not_a_metric":"something"},'
|
||||
'"BenchmarkScoreKeys":["i","j"]}';
|
||||
fs.file(resultsPath).writeAsStringSync(updateTaskJson);
|
||||
await cocoon.sendResultsPath(resultsPath: resultsPath);
|
||||
await cocoon.sendTaskStatus(resultsPath: resultsPath);
|
||||
});
|
||||
|
||||
test('Verify failure without retries for task result upload', () async {
|
||||
@@ -288,7 +288,7 @@ void main() {
|
||||
'"ResultData":{"i":0.0,"j":0.0,"not_a_metric":"something"},'
|
||||
'"BenchmarkScoreKeys":["i","j"]}';
|
||||
fs.file(resultsPath).writeAsStringSync(updateTaskJson);
|
||||
expect(() => cocoon.sendResultsPath(resultsPath: resultsPath), throwsA(isA<ClientException>()));
|
||||
expect(() => cocoon.sendTaskStatus(resultsPath: resultsPath), throwsA(isA<ClientException>()));
|
||||
});
|
||||
|
||||
test('throws client exception on non-200 responses', () async {
|
||||
@@ -310,7 +310,7 @@ void main() {
|
||||
'"ResultData":{"i":0.0,"j":0.0,"not_a_metric":"something"},'
|
||||
'"BenchmarkScoreKeys":["i","j"]}';
|
||||
fs.file(resultsPath).writeAsStringSync(updateTaskJson);
|
||||
expect(() => cocoon.sendResultsPath(resultsPath: resultsPath), throwsA(isA<ClientException>()));
|
||||
expect(() => cocoon.sendTaskStatus(resultsPath: resultsPath), throwsA(isA<ClientException>()));
|
||||
});
|
||||
|
||||
test('does not upload results on non-supported branches', () async {
|
||||
@@ -335,7 +335,32 @@ void main() {
|
||||
fs.file(resultsPath).writeAsStringSync(updateTaskJson);
|
||||
|
||||
// This will fail if it decided to upload results
|
||||
await cocoon.sendResultsPath(resultsPath: resultsPath);
|
||||
await cocoon.sendTaskStatus(resultsPath: resultsPath);
|
||||
});
|
||||
|
||||
test('does not update for staging test', () async {
|
||||
// Any network failure would cause the upoad to fail
|
||||
mockClient = MockClient((Request request) async => Response('', 500));
|
||||
|
||||
cocoon = Cocoon(
|
||||
serviceAccountTokenPath: serviceAccountTokenPath,
|
||||
fs: fs,
|
||||
httpClient: mockClient,
|
||||
requestRetryLimit: 0,
|
||||
);
|
||||
|
||||
const String resultsPath = 'results.json';
|
||||
const String updateTaskJson = '{'
|
||||
'"CommitBranch":"master",'
|
||||
'"CommitSha":"$commitSha",'
|
||||
'"BuilderName":"builderAbc",'
|
||||
'"NewStatus":"Succeeded",'
|
||||
'"ResultData":{"i":0.0,"j":0.0,"not_a_metric":"something"},'
|
||||
'"BenchmarkScoreKeys":["i","j"]}';
|
||||
fs.file(resultsPath).writeAsStringSync(updateTaskJson);
|
||||
|
||||
// This will fail if it decided to upload results
|
||||
await cocoon.sendTaskStatus(resultsPath: resultsPath, builderBucket: 'staging');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user