File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,15 @@ def capture &block
8888 end
8989 attr_reader :captured_output
9090
91+ # Simple wait method. Test for condition 5 times, delaying 1 second each time
92+ def wait_until times : 5 , delay : 1 , &condition
93+ times . times do
94+ return if condition . call
95+ sleep delay
96+ end
97+ raise "Condition not met. Waited #{ times } times with #{ delay } sec delay"
98+ end
99+
91100 example "create BigQuery client" do
92101 client = create_bigquery_client project_id : @project_id
93102
@@ -275,7 +284,12 @@ def capture &block
275284 "Inserted rows successfully\n "
276285 ) . to_stdout
277286
278- loaded_data = @table . data
287+ loaded_data = nil
288+
289+ wait_until do
290+ loaded_data = @table . data
291+ loaded_data . any?
292+ end
279293
280294 expect ( loaded_data ) . not_to be_empty
281295 expect ( loaded_data . count ) . to eq 2
You can’t perform that action at this time.
0 commit comments