Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
68b95cd0
Commit
68b95cd0
authored
Dec 16, 2017
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add CheckGcpProjectBillingWorker
parent
291480f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
0 deletions
+39
-0
app/workers/check_gcp_project_billing_worker.rb
app/workers/check_gcp_project_billing_worker.rb
+16
-0
spec/workers/check_gcp_project_billing_worker_spec.rb
spec/workers/check_gcp_project_billing_worker_spec.rb
+23
-0
No files found.
app/workers/check_gcp_project_billing_worker.rb
0 → 100644
View file @
68b95cd0
class
CheckGcpProjectBillingWorker
include
ApplicationWorker
def
self
.
redis_shared_state_key_for
(
token
)
"gitlab:gcp:
#{
token
}
:billing_enabled"
end
def
perform
(
token
)
return
unless
token
billing_enabled
=
CheckGcpProjectBillingService
.
new
.
execute
(
token
)
Gitlab
::
Redis
::
SharedState
.
with
do
|
redis
|
redis
.
set
(
self
.
class
.
redis_shared_state_key_for
(
token
),
billing_enabled
)
end
end
end
spec/workers/check_gcp_project_billing_worker_spec.rb
0 → 100644
View file @
68b95cd0
require
'spec_helper'
describe
CheckGcpProjectBillingWorker
do
describe
'.perform'
do
let
(
:token
)
{
'bogustoken'
}
subject
{
described_class
.
new
.
perform
(
token
)
}
it
'calls the service'
do
expect
(
CheckGcpProjectBillingService
).
to
receive_message_chain
(
:new
,
:execute
)
subject
end
it
'stores billing status in redis'
do
expect
(
CheckGcpProjectBillingService
).
to
receive_message_chain
(
:new
,
:execute
).
and_return
(
true
)
subject
Gitlab
::
Redis
::
SharedState
.
with
do
|
redis
|
expect
(
redis
.
get
(
"gitlab:gcp:
#{
token
}
:billing_enabled"
)).
to
eq
(
'true'
)
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment