Module: Nonnative::Cucumber::LifecycleSteps
- Included in:
- Registration
- Defined in:
- lib/nonnative/cucumber.rb
Constant Summary collapse
- SERVICE_UNAVAILABLE =
'service unavailable'
Instance Method Summary collapse
- #install_attempt_start_step ⇒ Object
- #install_attempt_stop_step ⇒ Object
- #install_healthy_step ⇒ Object
- #install_start_step ⇒ Object
- #install_state_steps ⇒ Object
- #install_unhealthy_step ⇒ Object
- #observability_options ⇒ Object
Instance Method Details
#install_attempt_start_step ⇒ Object
107 108 109 110 111 112 113 114 |
# File 'lib/nonnative/cucumber.rb', line 107 def install_attempt_start_step When('I attempt to start the system') do @start_error = nil Nonnative.start rescue StandardError => e @start_error = e end end |
#install_attempt_stop_step ⇒ Object
116 117 118 119 120 121 122 123 |
# File 'lib/nonnative/cucumber.rb', line 116 def install_attempt_stop_step When('I attempt to stop the system') do @stop_error = nil Nonnative.stop rescue StandardError => e @stop_error = e end end |
#install_healthy_step ⇒ Object
139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/nonnative/cucumber.rb', line 139 def install_healthy_step opts = Then('I should see {string} as healthy') do |service| service = service.downcase wait_for { Nonnative.observability.health(opts).code }.to eq(200) wait_for { Nonnative.observability.health(opts).body }.to satisfy do |body| body = body.to_s.strip.downcase !body.include?(SERVICE_UNAVAILABLE) && !body.include?(service) end end end |
#install_start_step ⇒ Object
101 102 103 104 105 |
# File 'lib/nonnative/cucumber.rb', line 101 def install_start_step When('I start the system') do Nonnative.start end end |
#install_state_steps ⇒ Object
93 94 95 96 97 98 99 |
# File 'lib/nonnative/cucumber.rb', line 93 def install_state_steps install_start_step install_attempt_start_step install_attempt_stop_step install_unhealthy_step install_healthy_step end |
#install_unhealthy_step ⇒ Object
125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/nonnative/cucumber.rb', line 125 def install_unhealthy_step opts = Then('I should see {string} as unhealthy') do |service| service = service.downcase wait_for { Nonnative.observability.health(opts).code }.to eq(503) wait_for { Nonnative.observability.health(opts).body }.to satisfy do |body| body = body.to_s.strip.downcase body.include?(SERVICE_UNAVAILABLE) || body.include?(service) end end end |
#observability_options ⇒ Object
153 154 155 156 157 158 159 |
# File 'lib/nonnative/cucumber.rb', line 153 def { headers: { content_type: :json, accept: :json }, read_timeout: 10, open_timeout: 10 } end |