Skip to content

Commit

Permalink
add sleep to storage_spec test in analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Yiu authored and Tim Yiu committed Aug 18, 2023
1 parent 724a7be commit f79a95c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
7 changes: 4 additions & 3 deletions spec/amplitude/storage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ module AmplitudeAnalytics
@provider = InMemoryStorageProvider.new
@storage = @provider.storage
@workers = Workers.new
config = Config.new
@storage.setup(config, @workers)
@workers.setup(config, @storage)
@config = Config.new
@storage.setup(@config, @workers)
@workers.setup(@config, @storage)
end

it 'checks if storage is empty after pull' do
Expand Down Expand Up @@ -68,6 +68,7 @@ module AmplitudeAnalytics

it 'exceeds max capacity and fails' do
push_event(@storage, Set.new, MAX_BUFFER_CAPACITY)
sleep(1)
expect(@storage.total_events).to eq(MAX_BUFFER_CAPACITY)

event = BaseEvent.new('test_event', user_id: 'test_user')
Expand Down
1 change: 0 additions & 1 deletion spec/amplitude/worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ module AmplitudeAnalytics
while @workers.storage.total_events > 0
sleep(0.1)
end
sleep(5)
total_events = @events_dict.values.sum(&:length)
expect(@workers.storage.total_events).to eq(0)
expect(total_events).to eq(5000)
Expand Down

0 comments on commit f79a95c

Please sign in to comment.