Line data Source code
1 : import 'package:testainers/src/testainers_base.dart';
2 : import 'package:testainers/src/testainers_utils.dart';
3 :
4 : class TestainersHttpBin extends Testainers {
5 : int? _httpPort;
6 :
7 1 : TestainersHttpBin({
8 : int? httpPort,
9 : super.config,
10 : super.name,
11 : super.image = 'kennethreitz/httpbin',
12 : super.tag = 'latest',
13 : super.ports = const <int, int>{},
14 : super.env = const <String, String>{},
15 : super.detached = true,
16 : super.remove = true,
17 : super.links,
18 : super.networks,
19 : super.healthCmd,
20 : super.healthInterval,
21 : super.healthRetries,
22 : super.healthTimeout,
23 : super.healthStartPeriod,
24 : super.noHealthcheck,
25 : super.stopTime,
26 : }) : _httpPort = httpPort;
27 :
28 2 : int get httpPort => _httpPort ?? -1;
29 :
30 1 : @override
31 : Future<Map<int, int>> portsFilter(Map<int, int> ports) async {
32 2 : _httpPort ??= await TestainersUtils.generatePort();
33 3 : return <int, int>{...ports, _httpPort!: 80};
34 : }
35 : }
|