Skip to content

Commit 05f63b6

Browse files
Merge pull request #155 from Workiva/O11Y-4317
O11Y-4317: update generated mocks and format project
2 parents fe77198 + 5e7326a commit 05f63b6

File tree

3 files changed

+43
-20
lines changed

3 files changed

+43
-20
lines changed

lib/src/sdk/trace/exporters/collector_exporter.dart

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@ class CollectorExporter implements sdk.SpanExporter {
4242
}
4343

4444
Future<void> _send(
45-
Uri uri,
46-
List<sdk.ReadOnlySpan> spans,
47-
) async {
48-
try {
49-
final body = pb_trace_service.ExportTraceServiceRequest(
50-
resourceSpans: _spansToProtobuf(spans));
51-
final headers = {'Content-Type': 'application/x-protobuf'}
52-
..addAll(this.headers);
53-
54-
await client.post(uri, body: body.writeToBuffer(), headers: headers);
55-
} catch (e) {
56-
_log.warning('Failed to export ${spans.length} spans.', e);
57-
}
45+
Uri uri,
46+
List<sdk.ReadOnlySpan> spans,
47+
) async {
48+
try {
49+
final body = pb_trace_service.ExportTraceServiceRequest(
50+
resourceSpans: _spansToProtobuf(spans));
51+
final headers = {'Content-Type': 'application/x-protobuf'}
52+
..addAll(this.headers);
53+
54+
await client.post(uri, body: body.writeToBuffer(), headers: headers);
55+
} catch (e) {
56+
_log.warning('Failed to export ${spans.length} spans.', e);
57+
}
5858
}
5959

6060
/// Group and construct the protobuf equivalent of the given list of [api.Span]s.

test/unit/mocks.mocks.dart

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright 2021-2022 Workiva.
22
// Licensed under the Apache License, Version 2.0. Please see https://github.com/Workiva/opentelemetry-dart/blob/master/LICENSE for more information
33

4-
// Mocks generated by Mockito 5.4.2 from annotations
4+
// Mocks generated by Mockito 5.4.4 from annotations
55
// in opentelemetry/test/unit/mocks.dart.
66
// Do not manually edit this file.
77

@@ -23,6 +23,8 @@ import 'package:opentelemetry/src/sdk/common/attributes.dart' as _i6;
2323
// ignore_for_file: avoid_redundant_argument_values
2424
// ignore_for_file: avoid_setters_without_getters
2525
// ignore_for_file: comment_references
26+
// ignore_for_file: deprecated_member_use
27+
// ignore_for_file: deprecated_member_use_from_same_package
2628
// ignore_for_file: implementation_imports
2729
// ignore_for_file: invalid_use_of_visible_for_testing_member
2830
// ignore_for_file: prefer_const_constructors
@@ -512,8 +514,23 @@ class MockHttpClient extends _i1.Mock implements _i3.Client {
512514
[url],
513515
{#headers: headers},
514516
),
515-
returnValue: _i9.Future<String>.value(''),
516-
returnValueForMissingStub: _i9.Future<String>.value(''),
517+
returnValue: _i9.Future<String>.value(_i8.dummyValue<String>(
518+
this,
519+
Invocation.method(
520+
#read,
521+
[url],
522+
{#headers: headers},
523+
),
524+
)),
525+
returnValueForMissingStub:
526+
_i9.Future<String>.value(_i8.dummyValue<String>(
527+
this,
528+
Invocation.method(
529+
#read,
530+
[url],
531+
{#headers: headers},
532+
),
533+
)),
517534
) as _i9.Future<String>);
518535

519536
@override
@@ -689,8 +706,14 @@ class MockReadOnlySpan extends _i1.Mock implements _i5.ReadOnlySpan {
689706
@override
690707
String get name => (super.noSuchMethod(
691708
Invocation.getter(#name),
692-
returnValue: '',
693-
returnValueForMissingStub: '',
709+
returnValue: _i8.dummyValue<String>(
710+
this,
711+
Invocation.getter(#name),
712+
),
713+
returnValueForMissingStub: _i8.dummyValue<String>(
714+
this,
715+
Invocation.getter(#name),
716+
),
694717
) as String);
695718

696719
@override

test/unit/sdk/exporters/collector_exporter_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ void main() {
195195
sub.cancel();
196196

197197
verify(mockClient.post(uri,
198-
body: anything, headers: {'Content-Type': 'application/x-protobuf'}))
199-
.called(1);
198+
body: anything,
199+
headers: {'Content-Type': 'application/x-protobuf'})).called(1);
200200

201201
expect(records, hasLength(1));
202202
expect(records[0].level, equals(Level.WARNING));

0 commit comments

Comments
 (0)