github.com/henvic/wedeploycli@v1.7.6-0.20200319005353-3630f582f284/functional/tests/restart.exp (about) 1 #!/usr/bin/expect 2 3 spawn $env(SHELL) 4 5 Feature: "Restart" 6 7 Scenario: "Select a service to restart" { 8 set restart1 [prefixed_project restart1] 9 create_project $restart1 10 create_service $restart1 ui1qa 11 create_service $restart1 ui2qa 12 13 send "$::bin restart\r" 14 expect { 15 timeout { handle_timeout; break } 16 "Type service ID or #" 17 } 18 send "ui2qa\r" 19 expect { 20 timeout { handle_timeout; break } 21 -gl "Restarting service*ui2qa*on project*$restart1" 22 } 23 send "$::bin curl \"/projects/$restart1/activities?type=SERVICE_RESTARTED\"\r" 24 expect { 25 timeout { handle_timeout; break } 26 -gl "\"serviceId\"*:*\"ui2qa\"*,*\"projectId\"*:*\"$restart1\"*\"SERVICE_RESTARTED\"" 27 } 28 expect /tests 29 send "$::bin curl \"/projects/$restart1/activities?type=SERVICE_RESTARTED\"\r" 30 expect { 31 timeout {} 32 -gl "\"serviceId\"*:*\"ui1qa\"*,*\"projectId\"*:*\"$restart1\"*\"SERVICE_RESTARTED\"" { 33 expectation_not_met "Should not have SERVICE_RESTARTED activity for ui1qa" 34 break 35 } 36 } 37 } { delete_project $restart1 } 38 39 Scenario: "Restart with -p flag" { 40 set restart2 [prefixed_project restart2] 41 set restart3 [prefixed_project restart3] 42 create_project $restart2 43 create_project $restart3 44 create_service $restart2 hosting1a 45 create_service $restart3 hosting1b 46 47 send "$::bin restart -p $restart2\r" 48 expect { 49 timeout {} 50 "hosting1b-$restart3" { 51 expectation_not_met "Should not show $restart3 project"; break 52 } 53 } 54 expect { 55 timeout { handle_timeout; break } 56 "hosting1a-$restart2" 57 } 58 expect { 59 timeout { handle_timeout; break } 60 "Type service ID or #" 61 } 62 send "1\r" 63 expect { 64 timeout { handle_timeout; break } 65 -gl "Restarting service*hosting1a*on project*$restart2" 66 } 67 send "$::bin curl /projects/$restart2/activities\r" 68 expect { 69 timeout { handle_timeout; break } 70 -gl "\"serviceId\"*:*\"hosting1a\"*,*\"projectId\"*:*\"$restart2\"*\"SERVICE_RESTARTED\"" 71 } 72 expect /tests 73 send "$::bin curl /projects/$restart3/activities\r" 74 expect { 75 timeout {} 76 "SERVICE_RESTARTED" { 77 expectation_not_met "Should not have SERVICE_RESTARTED activity for hosting1b" 78 break 79 } 80 } 81 } { 82 delete_project $restart2 83 delete_project $restart3 84 } 85 86 Scenario: "Restart with -p and -s flags" { 87 set restart4 [prefixed_project restart4] 88 set restart5 [prefixed_project restart5] 89 create_project $restart4 90 create_project $restart5 91 create_service $restart4 hosting1 92 create_service $restart5 hosting1 93 94 send "$::bin restart -p $restart5 -s hosting1\r" 95 expect { 96 timeout { handle_timeout; break } 97 -gl "Restarting service*hosting1*on project*$restart5" 98 } 99 send "$::bin curl /projects/$restart5/activities\r" 100 expect { 101 timeout { handle_timeout; break } 102 -gl "\"serviceId\"*:*\"hosting1\"*,*\"projectId\"*:*\"$restart5\"*\"SERVICE_RESTARTED\"" 103 } 104 expect /tests 105 send "$::bin curl /projects/$restart4/activities\r" 106 expect { 107 timeout {} 108 "SERVICE_RESTARTED" { 109 expectation_not_met "Should not have SERVICE_RESTARTED activity for $restart4" 110 break 111 } 112 } 113 } { 114 delete_project $restart4 115 delete_project $restart5 116 }