LCOV - code coverage report
Current view: top level - src - testainers_network.dart (source / functions) Coverage Total Hit
Test: testainers Lines: 0.0 % 20 0
Test Date: 2026-05-24 17:06:20 Functions: - 0 0

            Line data    Source code
       1              : import 'package:testainers/src/testainers_config.dart';
       2              : import 'package:testainers/src/testainers_utils.dart';
       3              : 
       4              : enum TestainersNetworkDriver {
       5              :   bridge,
       6              :   overlay;
       7              : }
       8              : 
       9              : class TestainersNetwork {
      10              :   final TestainersNetworkDriver driver;
      11              :   final bool attachable;
      12              :   final TestainersConfig config;
      13              :   final String name;
      14              :   String? id;
      15              : 
      16            0 :   TestainersNetwork({
      17              :     this.driver = TestainersNetworkDriver.bridge,
      18              :     this.attachable = true,
      19              :     this.config = const TestainersConfig(),
      20              :     String? name,
      21            0 :   }) : name = name ??
      22            0 :             '${TestainersUtils.generateName()}'
      23            0 :                 '${config.networkSuffix}';
      24              : 
      25            0 :   Future<String> create() async {
      26            0 :     final List<String> arguments = <String>[
      27              :       'network',
      28              :       'create',
      29              :       '--driver',
      30            0 :       driver.name,
      31            0 :       if (attachable) '--attachable',
      32            0 :       name,
      33              :     ];
      34              : 
      35            0 :     id = await config.exec(
      36              :       arguments: arguments,
      37            0 :       exceptionExec: 'Network $name not created.',
      38              :     );
      39              : 
      40            0 :     return id!;
      41              :   }
      42              : 
      43            0 :   Future<void> remove({bool force = false}) async {
      44            0 :     final List<String> arguments = <String>[
      45              :       'network',
      46              :       'rm',
      47            0 :       if (force) '--force',
      48            0 :       name,
      49              :     ];
      50              : 
      51            0 :     await config.execAndCheck(
      52              :       arguments: arguments,
      53            0 :       check: name,
      54            0 :       exceptionExec: 'Network $name not removed.',
      55            0 :       exceptionCheck: 'Check if the network $name has stopped.',
      56              :     );
      57              :   }
      58              : }
        

Generated by: LCOV version 2.0-1