mirror of https://github.com/grpc/grpc-dart.git
Make sure that grpc_web.dart builds on the Web (#427)
c48af63 accidentally introduced a dependency on VM specific libraries in the shared code
Fix envoy configuration to make sure grpcweb tests runs
This commit is contained in:
parent
93c21feb56
commit
fbcb426f21
|
|
@ -17,11 +17,11 @@ import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:grpc/grpc.dart';
|
|
||||||
import 'package:grpc/src/generated/google/rpc/status.pb.dart';
|
import 'package:grpc/src/generated/google/rpc/status.pb.dart';
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
import 'package:protobuf/protobuf.dart';
|
import 'package:protobuf/protobuf.dart';
|
||||||
|
|
||||||
|
import '../shared/codec.dart';
|
||||||
import '../shared/message.dart';
|
import '../shared/message.dart';
|
||||||
import '../shared/profiler.dart';
|
import '../shared/profiler.dart';
|
||||||
import '../shared/status.dart';
|
import '../shared/status.dart';
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,9 @@ static_resources:
|
||||||
socket_address: { address: 0.0.0.0, port_value: 0 }
|
socket_address: { address: 0.0.0.0, port_value: 0 }
|
||||||
filter_chains:
|
filter_chains:
|
||||||
- filters:
|
- filters:
|
||||||
- name: envoy.http_connection_manager
|
- name: envoy.filters.network.http_connection_manager
|
||||||
config:
|
typed_config:
|
||||||
|
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
|
||||||
codec_type: auto
|
codec_type: auto
|
||||||
stat_prefix: ingress_http
|
stat_prefix: ingress_http
|
||||||
route_config:
|
route_config:
|
||||||
|
|
@ -52,7 +53,10 @@ static_resources:
|
||||||
domains: ["*"]
|
domains: ["*"]
|
||||||
routes:
|
routes:
|
||||||
- match: { prefix: "/" }
|
- match: { prefix: "/" }
|
||||||
route: { cluster: echo_service }
|
route:
|
||||||
|
cluster: echo_service
|
||||||
|
max_stream_duration:
|
||||||
|
grpc_timeout_header_max: 0s
|
||||||
cors:
|
cors:
|
||||||
allow_origin_string_match:
|
allow_origin_string_match:
|
||||||
- prefix: "*"
|
- prefix: "*"
|
||||||
|
|
@ -70,11 +74,30 @@ static_resources:
|
||||||
type: static
|
type: static
|
||||||
http2_protocol_options: {}
|
http2_protocol_options: {}
|
||||||
lb_policy: round_robin
|
lb_policy: round_robin
|
||||||
hosts:
|
load_assignment:
|
||||||
- socket_address: { address: 127.0.0.1, port_value: %TARGET_PORT% }
|
cluster_name: cluster_0
|
||||||
|
endpoints:
|
||||||
|
- lb_endpoints:
|
||||||
|
- endpoint:
|
||||||
|
address:
|
||||||
|
socket_address:
|
||||||
|
address: 127.0.0.1
|
||||||
|
port_value: %TARGET_PORT%
|
||||||
''';
|
''';
|
||||||
|
|
||||||
hybridMain(StreamChannel channel) async {
|
hybridMain(StreamChannel channel) async {
|
||||||
|
// Envoy output will be collected and dumped to stdout if envoy exits
|
||||||
|
// with an error. Otherwise if verbose is specified it will be dumped
|
||||||
|
// to stdout unconditionally.
|
||||||
|
final output = <String>[];
|
||||||
|
void _info(String line) {
|
||||||
|
if (!verbose) {
|
||||||
|
output.add(line);
|
||||||
|
} else {
|
||||||
|
print(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Spawn a gRPC server.
|
// Spawn a gRPC server.
|
||||||
final server = Server([EchoService()]);
|
final server = Server([EchoService()]);
|
||||||
await server.serve(port: 0);
|
await server.serve(port: 0);
|
||||||
|
|
@ -127,6 +150,9 @@ if you are running tests locally.
|
||||||
proxy.exitCode.then((value) {
|
proxy.exitCode.then((value) {
|
||||||
_info('proxy quit with ${value}');
|
_info('proxy quit with ${value}');
|
||||||
if (value != 0) {
|
if (value != 0) {
|
||||||
|
if (!verbose) {
|
||||||
|
stdout.writeAll(output, '\n');
|
||||||
|
}
|
||||||
channel.sink.addError('proxy exited with ${value}');
|
channel.sink.addError('proxy exited with ${value}');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -139,9 +165,3 @@ if you are running tests locally.
|
||||||
}
|
}
|
||||||
channel.sink.add('EXITED');
|
channel.sink.add('EXITED');
|
||||||
}
|
}
|
||||||
|
|
||||||
void _info(String line) {
|
|
||||||
if (verbose) {
|
|
||||||
print(line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue