File tree Expand file tree Collapse file tree
spec/unit/lib/cloud_controller/errands Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -117,12 +117,14 @@ def encrypted_columns(model_klass)
117117 shared_examples 'unencrypted fields' do
118118 it 'do not change their values' do
119119 entity = encrypted_models [ klass ]
120- vals = entity . reload . values . except ( *encrypted_columns ( entity . class ) )
120+ string_columns_with_nil_value = entity . values . select { |_k , v | v . is_a? ( String ) && v . nil? } . keys
121+ vals = entity . reload . values . except ( *encrypted_columns ( entity . class ) , *string_columns_with_nil_value )
121122 expect ( vals . values . all? ( &:present? ) ) . to be_truthy , "all fields of #{ entity . class } need to have values"
122123
123124 RotateDatabaseKey . perform ( batch_size : 1 )
124125
125- expect ( entity . reload . values . except ( *encrypted_columns ( entity . class ) ) ) . to eq ( vals )
126+ expect ( entity . reload . values . except ( *encrypted_columns ( entity . class ) , *string_columns_with_nil_value ) ) . to eq ( vals )
127+ expect ( entity . values . select { |k , _v | string_columns_with_nil_value . include? ( k ) } ) . to be_all ( &:nil? )
126128 end
127129 end
128130
You can’t perform that action at this time.
0 commit comments