BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
68b95cd0
Unverified
Commit
68b95cd0
authored
Dec 16, 2017
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add CheckGcpProjectBillingWorker
parent
291480f5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
0 deletions
+39
-0
check_gcp_project_billing_worker.rb
app/workers/check_gcp_project_billing_worker.rb
+16
-0
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