File tree Expand file tree Collapse file tree
test/unit/krane/kubernetes_resource Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11## next
22
3+ ## 3.8.1
4+
5+ - check if observedGeneration is present before comparing with generation for custom resources
6+
37## 3.8.0
48
59- Add Elasticsearch resource to the black list so it is not marked for deletion
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ def failure_message
3939 end
4040
4141 def timeout_message
42- if rollout_conditions && current_generation != observed_generation
42+ if observed_generation . present? && rollout_conditions && current_generation != observed_generation
4343 TIMEOUT_MESSAGE_DIFFERENT_GENERATIONS
4444 else
4545 super
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22module Krane
3- VERSION = "3.8.0 "
3+ VERSION = "3.8.1 "
44end
Original file line number Diff line number Diff line change @@ -159,11 +159,20 @@ def test_instance_timeout_annotation
159159 end
160160
161161 def test_instance_timeout_messages_with_rollout_conditions
162+ rollout_conditions = {
163+ success_conditions : [
164+ {
165+ path : "$.status.conditions[?(@.type == 'Ready')].status" ,
166+ value : "True" ,
167+ } ,
168+ ] ,
169+ } . to_json
170+
162171 crd = build_crd ( crd_spec . merge (
163172 "metadata" => {
164173 "name" => "unittests.stable.example.io" ,
165174 "annotations" => {
166- rollout_conditions_annotation_key => "true" ,
175+ rollout_conditions_annotation_key => rollout_conditions ,
167176 } ,
168177 } ,
169178 ) )
@@ -176,12 +185,12 @@ def test_instance_timeout_messages_with_rollout_conditions
176185 } ,
177186 } )
178187
179- cr . expects ( :current_generation ) . returns ( 1 )
180- cr . expects ( :observed_generation ) . returns ( 1 )
188+ cr . expects ( :current_generation ) . at_least_once . returns ( 1 )
189+ cr . expects ( :observed_generation ) . at_least_once . returns ( 1 )
181190 assert_equal ( cr . timeout_message , Krane ::KubernetesResource ::STANDARD_TIMEOUT_MESSAGE )
182191
183- cr . expects ( :current_generation ) . returns ( 1 )
184- cr . expects ( :observed_generation ) . returns ( 2 )
192+ cr . expects ( :current_generation ) . at_least_once . returns ( 1 )
193+ cr . expects ( :observed_generation ) . at_least_once . returns ( 2 )
185194 assert_equal ( cr . timeout_message , Krane ::CustomResource ::TIMEOUT_MESSAGE_DIFFERENT_GENERATIONS )
186195 end
187196
You can’t perform that action at this time.
0 commit comments