Skip to content

Commit

Permalink
ci: disable broken integration test (#1604)
Browse files Browse the repository at this point in the history
  • Loading branch information
vaind committed Aug 23, 2023
1 parent d189e01 commit f0fcbe1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
24 changes: 13 additions & 11 deletions .github/workflows/flutter_integration_test.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
name: flutter integration tests
on:
push:
branches:
- main
- release/**
pull_request:
paths-ignore:
- 'file/**'
# Currently broken, enable after fixing
workflow_dispatch
# push:
# branches:
# - main
# - release/**
# pull_request:
# paths-ignore:
# - 'file/**'

jobs:
cancel-previous-workflow:
Expand All @@ -26,15 +28,15 @@ jobs:
strategy:
fail-fast: false
matrix:
sdk: ['stable', 'beta']
sdk: ["stable", "beta"]
steps:
- name: checkout
uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
distribution: "adopt"
java-version: "11"

- uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # pin@v2.10.0
with:
Expand Down Expand Up @@ -93,7 +95,7 @@ jobs:
fail-fast: false
matrix:
# 'beta' is flaky because of https://github.com/flutter/flutter/issues/124340
sdk: ['stable']
sdk: ["stable"]
steps:
- name: checkout
uses: actions/checkout@v3
Expand Down
12 changes: 10 additions & 2 deletions flutter/example/integration_test/integration_test.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ignore_for_file: avoid_print

import 'dart:async';
import 'dart:convert';

Expand Down Expand Up @@ -160,6 +162,7 @@ void main() {
final uri = Uri.parse(
'https://sentry.io/api/0/projects/$org/$slug/events/$id/',
);
expect(authToken, isNotEmpty);

final event = await fixture.poll(uri, authToken);
expect(event, isNotNull);
Expand Down Expand Up @@ -206,26 +209,31 @@ class Fixture {

const maxRetries = 10;
const initialDelay = Duration(seconds: 2);
const factor = 2;
const delayIncrease = Duration(seconds: 2);

var retries = 0;
var delay = initialDelay;

while (retries < maxRetries) {
try {
print("Trying to fetch $url [try $retries/$maxRetries]");
final response = await client.get(
url,
headers: <String, String>{'Authorization': 'Bearer $authToken'},
);
print("Response status code: ${response.statusCode}");
if (response.statusCode == 200) {
return jsonDecode(utf8.decode(response.bodyBytes));
} else if (response.statusCode == 401) {
print("Cannot fetch $url - invalid auth token.");
break;
}
} catch (e) {
// Do nothing
} finally {
retries++;
await Future.delayed(delay);
delay *= factor;
delay += delayIncrease;
}
}
return null;
Expand Down

0 comments on commit f0fcbe1

Please sign in to comment.