Skip to content
This repository was archived by the owner on Jun 2, 2021. It is now read-only.

Commit 885720c

Browse files
authored
Merge pull request cloudfoundry#1601 from joyvuu-dave/master
Create consistent AppUsageEvent records
2 parents bfbfe0a + 263d771 commit 885720c

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

app/repositories/app_usage_event_repository.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ def purge_and_reseed_started_apps!
110110
space_name: "#{Space.table_name}__name".to_sym,
111111
org_guid: "#{Organization.table_name}__guid".to_sym,
112112
created_at: Sequel.datetime_class.now,
113+
parent_app_name: :parent_app__name,
114+
parent_app_guid: :parent_app__guid,
113115
}
114116

115117
latest_package_query = PackageModel.select(:app_guid).select_append { max(id).as(:id) }.group(:app_guid)

spec/unit/repositories/app_usage_event_repository_spec.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,13 @@ module Repositories
546546
expect(AppUsageEvent.last).to match_app(process)
547547
end
548548

549+
it 'sets the parent_app_name and parent_app_guid' do
550+
repository.purge_and_reseed_started_apps!
551+
552+
expect(AppUsageEvent.last.parent_app_name).to eq(process.app.name)
553+
expect(AppUsageEvent.last.parent_app_guid).to eq(process.app.guid)
554+
end
555+
549556
context 'with associated buildpack information' do
550557
before do
551558
process.desired_droplet.update(

0 commit comments

Comments
 (0)