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