github.com/mysteriumnetwork/node@v0.0.0-20240516044423-365054f76801/bin/test_e2e_compatibility (about)

     1  #!/usr/bin/env bash
     2  
     3  PROJECT_FILE="bin/localnet/docker-compose.yml"
     4  
     5  source bin/localnet/functions.sh
     6  
     7  function printResults {
     8      echo "-----------------------------------------"
     9      for res in "${result[@]}"
    10      do
    11          printf '%s\n' "$res"
    12      done
    13      echo "-----------------------------------------"
    14  }
    15  
    16  projectName="node_e2e_compatibility_test"
    17  projectFiles=("e2e/compatibility-matrix/docker-compose.yml")
    18  
    19  consumerVersions=(0.5 local)
    20  providerVersions=(0.5 local)
    21  errorOccured=0
    22  result=()
    23  
    24  setupDockerComposeCmd $projectName ${projectFiles[@]}
    25  $dockerComposeCmd logs -f > e2e_tests.log &
    26  
    27  # Provider loop
    28  for i in "${providerVersions[@]}"
    29  do
    30      # Consumer loop
    31      for j in "${consumerVersions[@]}"
    32      do
    33          echo "RUNNING E2E COMPATIBILITY FOR CONSUMER $j vs PROVIDER $i"
    34          setupInfra $projectName ${projectFiles[@]}
    35  
    36          $dockerComposeCmd up -d myst-provider-$i myst-consumer-$j ipify
    37          if [ ! $? -eq 0 ]
    38          then
    39              print_error "Image building failed"
    40              cleanup $projectName
    41              exit 1
    42          fi
    43  
    44          # this indicates which services the consumer will use in its test suite
    45          consumerServices="openvpn,noop,wireguard"
    46          # on versions older than 0.5 we don't have noop and wireguard, only openvpn
    47          if [ $(echo "$j < 0.5" | bc -l) == 1 ] && [ "$j" != "local" ]; then
    48              consumerServices="openvpn"
    49          fi
    50  
    51          $dockerComposeCmd run go-runner \
    52              go test -v ./e2e/... -args \
    53              --provider.tequilapi-host=myst-provider-$i \
    54              --provider.tequilapi-port=4050 \
    55              --consumer.tequilapi-port=4050 \
    56              --consumer.services=$consumerServices
    57          if [ ! $? -eq 0 ]; then
    58              print_error "Tests failed"
    59              sleep 150
    60              errorOccured=1
    61              result+=("Consumer $i Provider $j: FAIL!")
    62          else
    63              print_success "Tests passed"
    64              result+=("Consumer $i Provider $j: SUCCESS!")
    65          fi
    66  
    67          $dockerComposeCmd down
    68      done
    69  done
    70  
    71  if [ $errorOccured = 1 ]; then
    72      cleanup $projectName
    73      print_error "Test suite failed"
    74      printResults
    75      exit 1
    76  else
    77      cleanup $projectName
    78      print_success "Test suite passed"
    79      printResults
    80      exit 0
    81  fi