github.com/docker/engine@v22.0.0-20211208180946-d456264580cf+incompatible/libnetwork/test/integration/dnet/overlay-consul.bats (about)

     1  # -*- mode: sh -*-
     2  #!/usr/bin/env bats
     3  
     4  load helpers
     5  
     6  @test "Test overlay network with consul" {
     7      test_overlay consul
     8  }
     9  
    10  @test "Test overlay network singlehost with consul" {
    11      test_overlay_singlehost consul
    12  }
    13  
    14  @test "Test overlay network with dnet restart" {
    15      test_overlay consul skip_rm
    16      docker restart dnet-1-consul
    17      wait_for_dnet $(inst_id2port 1) dnet-1-consul
    18      docker restart dnet-2-consul
    19      wait_for_dnet $(inst_id2port 2) dnet-2-consul
    20      docker restart dnet-3-consul
    21      wait_for_dnet $(inst_id2port 3) dnet-3-consul
    22      test_overlay consul skip_add
    23  }
    24  
    25  @test "Test overlay network internal network with consul" {
    26      test_overlay consul internal
    27  }
    28  
    29  @test "Test overlay network with dnet ungraceful shutdown" {
    30      dnet_cmd $(inst_id2port 1) network create -d overlay multihost
    31      start=1
    32      end=3
    33      for i in `seq ${start} ${end}`;
    34      do
    35  	dnet_cmd $(inst_id2port $i) container create container_${i}
    36  	net_connect ${i} container_${i} multihost
    37      done
    38  
    39      hrun runc $(dnet_container_name 1 consul) $(get_sbox_id 1 container_1) "ifconfig eth0"
    40      container_1_ip=$(echo ${output} | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
    41  
    42      # ungracefully kill dnet-1-consul container
    43      docker rm -f dnet-1-consul
    44  
    45      # forcefully unpublish the service from dnet2 when dnet1 is dead.
    46      dnet_cmd $(inst_id2port 2) service unpublish -f container_1.multihost
    47      dnet_cmd $(inst_id2port 2) container create container_1
    48      net_connect 2 container_1 multihost
    49  
    50      hrun runc $(dnet_container_name 2 consul) $(get_sbox_id 2 container_1) "ifconfig eth0"
    51      container_1_new_ip=$(echo ${output} | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
    52  
    53      if [ "$container_1_ip" != "$container_1_new_ip" ]; then
    54  	exit 1
    55      fi
    56  }