Rename CheckGcpProjectBillingWorker to ListGcpProjectsWorker

This commit is contained in:
Matija Čupić 2018-04-20 17:02:48 +02:00
parent cffc8899b7
commit 3b1612515f
No known key found for this signature in database
GPG key ID: 4BAF84FFACD2E5DE
5 changed files with 8 additions and 8 deletions

View file

@ -83,12 +83,12 @@ class Projects::Clusters::GcpController < Projects::ApplicationController
end end
def authorize_google_project_billing def authorize_google_project_billing
redis_token_key = CheckGcpProjectBillingWorker.store_session_token(token_in_session) redis_token_key = ListGcpProjectsWorker.store_session_token(token_in_session)
CheckGcpProjectBillingWorker.perform_async(redis_token_key) ListGcpProjectsWorker.perform_async(redis_token_key)
end end
def google_project_billing_status def google_project_billing_status
CheckGcpProjectBillingWorker.get_billing_state(token_in_session) ListGcpProjectsWorker.get_billing_state(token_in_session)
end end
def token_in_session def token_in_session

View file

@ -24,7 +24,7 @@
- gcp_cluster:cluster_provision - gcp_cluster:cluster_provision
- gcp_cluster:cluster_wait_for_app_installation - gcp_cluster:cluster_wait_for_app_installation
- gcp_cluster:wait_for_cluster_creation - gcp_cluster:wait_for_cluster_creation
- gcp_cluster:check_gcp_project_billing - gcp_cluster:list_gcp_projects
- gcp_cluster:cluster_wait_for_ingress_ip_address - gcp_cluster:cluster_wait_for_ingress_ip_address
- github_import_advance_stage - github_import_advance_stage

View file

@ -1,6 +1,6 @@
require 'securerandom' require 'securerandom'
class CheckGcpProjectBillingWorker class ListGcpProjectsWorker
include ApplicationWorker include ApplicationWorker
include ClusterQueue include ClusterQueue
@ -64,7 +64,7 @@ class CheckGcpProjectBillingWorker
def try_obtain_lease_for(token) def try_obtain_lease_for(token)
Gitlab::ExclusiveLease Gitlab::ExclusiveLease
.new("check_gcp_project_billing_worker:#{token.hash}", timeout: LEASE_TIMEOUT) .new("list_gcp_projects_worker:#{token.hash}", timeout: LEASE_TIMEOUT)
.try_obtain .try_obtain
end end

View file

@ -144,7 +144,7 @@ describe Projects::Clusters::GcpController do
before do before do
redis_double = double redis_double = double
allow(Gitlab::Redis::SharedState).to receive(:with).and_yield(redis_double) allow(Gitlab::Redis::SharedState).to receive(:with).and_yield(redis_double)
allow(redis_double).to receive(:get).with(CheckGcpProjectBillingWorker.redis_shared_state_key_for('token')).and_return('true') allow(redis_double).to receive(:get).with(ListGcpProjectsWorker.redis_shared_state_key_for('token')).and_return('true')
end end
it 'creates a new cluster' do it 'creates a new cluster' do

View file

@ -1,6 +1,6 @@
require 'spec_helper' require 'spec_helper'
describe CheckGcpProjectBillingWorker do describe ListGcpProjectsWorker do
describe '.perform' do describe '.perform' do
let(:token) { 'bogustoken' } let(:token) { 'bogustoken' }