Check behaviour when adding more than one cluster
This commit is contained in:
parent
1a9cef7962
commit
afcfe182a6
1 changed files with 60 additions and 34 deletions
|
@ -7,6 +7,7 @@ describe Clusters::CreateService do
|
|||
let(:result) { described_class.new(project, user, params).execute(access_token) }
|
||||
|
||||
context 'when provider is gcp' do
|
||||
context 'when project has no clusters' do
|
||||
context 'when correct params' do
|
||||
let(:params) do
|
||||
{
|
||||
|
@ -61,4 +62,29 @@ describe Clusters::CreateService do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when project has a cluster' do
|
||||
let(:params) do
|
||||
{
|
||||
name: 'test-cluster',
|
||||
provider_type: :gcp,
|
||||
provider_gcp_attributes: {
|
||||
gcp_project_id: 'gcp-project',
|
||||
zone: 'us-central1-a',
|
||||
num_nodes: 1,
|
||||
machine_type: 'machine_type-a'
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
before do
|
||||
Clusters::Cluster.create(params.merge(user: user, projects: [project]))
|
||||
end
|
||||
|
||||
it 'does not create a cluster' do
|
||||
expect(ClusterProvisionWorker).not_to receive(:perform_async)
|
||||
expect { result }.to change { Clusters::Cluster.count }.by(0)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue