-
Notifications
You must be signed in to change notification settings - Fork 15
Dt e3 0 update #304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Dt e3 0 update #304
Changes from 99 commits
fab7c08
f2e72af
4a382f9
248945a
dc4a2be
455b3f0
e8f725d
f106d61
f88746a
6d765e0
ed7692e
4a1c644
e9ffa09
c2c73c8
88f4609
2936ca8
0b795d7
e51a0b0
f64bddc
f071b95
6f0b2a1
b5baad3
4e2bad2
059fc53
219e895
41f93e4
899bd02
b879509
5f0a570
11b9b24
8768efb
e5af52e
afde6c8
83cb0b0
d2f4ff9
72b0fb6
3854893
7b7b75c
d82809f
7a52acc
e0a5134
3772b1d
702876c
901291f
1c0902c
2d0c097
452ebcd
3c39d86
5534a6b
027b7b1
7816288
e64b55d
ed06036
86d81ac
4deb250
63814d7
28a5cb4
a98610a
7f5dfdc
bea2d70
b0c526c
817fc5e
388a525
0da2b02
24c9756
5bbfc9c
799ea4f
700c08c
120b868
18c1c62
1f132d0
5156cf6
2e89e78
d9f80dc
fea81a6
0ddc5e6
f01527f
b9b568c
b8ad401
3762a4f
61783a5
bafcd03
00d8750
8d1299b
b5ff0df
31ac5ba
58dbb78
f31e9a3
0152ef2
022eff3
ae102f5
6bed9d0
ec52f0a
79d54c1
7c7c654
da76215
d16a4b4
ba23d18
1d6f840
1044296
846ae7f
cd7bd69
353bc62
d3ce4e9
8cc1bfd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,8 @@ class SetQueue < Struct.new(:context, :job, :opts) | |
|
|
||
| MSGS = { | ||
| redirect: 'Found job.queue: %s. Redirecting to: %s', | ||
| queue: 'Setting queue to %s for job=%s' | ||
| queue: 'Setting queue to %s for job=%s', | ||
| canceled: 'Build %s has been canceled, job %s being canceled' | ||
| }.freeze | ||
|
|
||
| def run | ||
|
|
@@ -23,7 +24,17 @@ def run | |
| private | ||
|
|
||
| def queue | ||
| @queue ||= redirect(Queue.new(job, config, logger).select) | ||
| if job.stage.present? && job.stage.state == "canceled" | ||
| info MSGS[:canceled] % [job.source.id, job.id] | ||
| payload = { id: job.id, source: 'scheduler' } | ||
| Hub.push('job:cancel', payload) | ||
| else | ||
| @queue ||= redirect(Queue.new(job, config, logger).select) | ||
| end | ||
| rescue => e | ||
| puts "ERROR while trying to queue: #{e.message}" | ||
| puts "Backtrace:" | ||
| puts e.backtrace.join("\n")@queue ||= redirect(Queue.new(job, config, logger).select) | ||
|
||
| end | ||
|
|
||
| # TODO: confirm we don't need queue redirection any more | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,8 @@ | |
| let(:user) { FactoryBot.create(:user) } | ||
| let(:repo) { FactoryBot.create(:repository) } | ||
| let(:authorize_build_url) { "http://localhost:9292/users/#{user.id}/plan" } | ||
| let(:repo) { FactoryGirl.create(:repository) } | ||
|
||
| let(:authorize_build_url) { "http://localhost:9292/users/#{user.id}/plan" } | ||
|
|
||
| describe 'constants' do | ||
| # It isn't often that we see tests for constants, but these are special. | ||
|
|
@@ -82,6 +84,19 @@ | |
| end | ||
| end | ||
|
|
||
| context "paid_new_plan? == true" do | ||
| before do | ||
| user.stubs(:paid_new_plan?).returns(true) | ||
| stub_request(:get, authorize_build_url).to_return( | ||
| body: MultiJson.dump(plan_name: 'two_concurrent_plan', hybrid: true, free: false, status: 'subscribed', metered: false) | ||
| ) | ||
| end | ||
|
|
||
| it "returns the DEFAULT_SUBSCRIBED_TIMEOUT" do | ||
| expect(user.default_worker_timeout).to eq Organization::DEFAULT_SUBSCRIBED_TIMEOUT | ||
| end | ||
| end | ||
|
|
||
| context 'paid_new_plan? == true' do | ||
| before do | ||
| user.stubs(:paid_new_plan?).returns(true) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
double accept?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.