github.com/henvic/wedeploycli@v1.7.6-0.20200319005353-3630f582f284/functional/tests/quota.exp (about)

     1  #!/usr/bin/expect
     2  
     3  if { $_mode != "complete" } {
     4    print_msg_stderr "\nSkipping quota tests\n"
     5    return
     6  }
     7  
     8  spawn $env(SHELL)
     9  
    10  Feature: "Quota"
    11  
    12  Scenario: "Cannot exceed project quota" {
    13    set_user_plan basic
    14    sleep 5
    15  
    16    set quota1 [prefixed_project quota1]
    17    set quota2 [prefixed_project quota2]
    18    set quota3 [prefixed_project quota3]
    19    set quota4 [prefixed_project quota4]
    20    create_project $quota1
    21    create_project $quota2
    22    create_project $quota3
    23  
    24    send "$::bin new\r"
    25    expect {
    26      timeout { handle_timeout; break }
    27      "Do you want to*create*a new project or install a new service?"
    28    }
    29    send "1\r"
    30    expect {
    31      timeout { handle_timeout; break }
    32      "Choose a project ID"
    33    }
    34    send "$quota4\r"
    35    expect {
    36      timeout { handle_timeout; break }
    37      "You've reached your plan limits"
    38    }
    39    send "$::bin list\r"
    40    expect {
    41      timeout {}
    42      "$quota4" { expectation_not_met "Should not have project \"$quota4\""; break }
    43    }
    44  }
    45  
    46  Scenario: "Cannot exceed service quota" {
    47    set quota1 [prefixed_project quota1]
    48    set quota2 [prefixed_project quota2]
    49    create_service $quota1 hosting1
    50    create_service $quota2 hosting1
    51    create_service $quota2 hosting2
    52  
    53    send "$::bin new\r"
    54    expect {
    55      timeout { handle_timeout; break }
    56      "Do you want to*create*a new project or install a new service?"
    57    }
    58    send "2\r"
    59    expect {
    60      timeout { handle_timeout; break }
    61      "Type project ID or #"
    62    }
    63    send "2\r"
    64    expect {
    65      timeout { handle_timeout; break }
    66      "Choose a Service ID"
    67    }
    68    send "hosting3\r"
    69    expect {
    70      timeout { handle_timeout; break }
    71      "Select a Service Type"
    72    }
    73    send "4\r"
    74    expect {
    75      timeout { handle_timeout; break }
    76      "You've reached your plan limits"
    77    }
    78    send "$::bin list\r"
    79    expect {
    80      timeout {}
    81      "hosting3" {
    82        expectation_not_met "Should not have service \"hosting3\""
    83        break
    84      }
    85    }
    86  }
    87  
    88  Scenario: "Cannot exceed custom domains quota" {
    89    set quota1 [prefixed_project quota1]
    90    set quota2 [prefixed_project quota2]
    91    set quota3 [prefixed_project quota3]
    92    set qadomain1 qadomain1.$::_service_domain
    93    set qadomain2 qadomain2.$::_service_domain
    94    set qadomain3 qadomain3.$::_service_domain
    95    set qadomain4 qadomain4.$::_service_domain
    96  
    97    send "$::bin domain add $qadomain1 -p $quota1 -s hosting1\r"
    98    expect {
    99      timeout { handle_timeout; break }
   100      "Custom domain \"$qadomain1\" added."
   101    }
   102    send "$::bin domain add $qadomain2 -p $quota1 -s hosting1\r"
   103    expect {
   104      timeout { handle_timeout; break }
   105      "Custom domain \"$qadomain2\" added."
   106    }
   107    send "$::bin domain add $qadomain3 -p $quota1 -s hosting1\r"
   108    expect {
   109      timeout { handle_timeout; break }
   110      "Custom domain \"$qadomain3\" added."
   111    }
   112    send "$::bin domain add $qadomain4 -p $quota1 -s hosting1\r"
   113    expect {
   114      timeout { handle_timeout; break }
   115      "You've reached your plan limits"
   116    }
   117    send "$::bin domain show -p $quota1 -s hosting1\r"
   118    expect {
   119      timeout {}
   120      $qadomain4 {
   121        expectation_not_met "Should not have custom domain \"$qadomain4\""
   122        break
   123      }
   124    }
   125  } {
   126    delete_project $quota1
   127    delete_project $quota2
   128    delete_project $quota3
   129  }