HTTP 探测改为填写网址,缺本机引擎时立刻失败
HTTP 模式不再单独填端口。完整网址沿用其中的协议、端口和路径;只写主机名或 IP 时按 http 和 80 端口。超时默认改为 5000 毫秒。本机找不到或启动不了 netquality-reflector 时直接说明原因,并建议改用远程节点,不再记成一次全部失败。 Co-authored-by: yanjiu0721 <yanjiu0721@users.noreply.github.com>
This commit is contained in:
1 parent
846e40c023
commit
918ec8f190
20 files changed
+807
-131
No files matched your search
@@ -6,6 +6,7 @@ import 'dart:typed_data';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:netquality/metrics/sample_book.dart';
|
||||
import 'package:netquality/probe/game_codec.dart';
|
||||
import 'package:netquality/probe/http_helper.dart';
|
||||
import 'package:netquality/probe/probe_loop.dart';
|
||||
import 'package:netquality/probe/remote_client.dart';
|
||||
|
||||
@@ -389,6 +390,37 @@ void main() {
|
||||
expect(samples.single.detail['httpVersion'], '1.1');
|
||||
expect(samples.single.summary.failurePct, 0);
|
||||
});
|
||||
|
||||
test('a missing local http helper records no loss sample', () async {
|
||||
final samples = <ProbeSample>[];
|
||||
final loop = ProbeLoop(helperPath: '/no/such/netquality-reflector');
|
||||
await expectLater(
|
||||
loop.run(
|
||||
request: const ProbeRequest(
|
||||
host: 'http://127.0.0.1/health',
|
||||
port: 80,
|
||||
profileId: 'http',
|
||||
interval: Duration(milliseconds: 200),
|
||||
timeout: Duration(seconds: 1),
|
||||
packetSize: 64,
|
||||
echoToken: '',
|
||||
dnsName: '',
|
||||
payloadHex: '',
|
||||
expectHex: '',
|
||||
),
|
||||
onSample: samples.add,
|
||||
cancelled: () => false,
|
||||
),
|
||||
throwsA(
|
||||
isA<LocalHttpHelperException>().having(
|
||||
(error) => error.message,
|
||||
'message',
|
||||
contains('远程节点'),
|
||||
),
|
||||
),
|
||||
);
|
||||
expect(samples, isEmpty);
|
||||
});
|
||||
}
|
||||
|
||||
Future<List<ProbeSample>> _collect(
|
||||
|
||||
Reference in new issue
Block a user