Files
ubicloud/spec/model/minio/minio_cluster_spec.rb
Furkan Sahin 12dbeb57a1 Update location references with foreign key in the controlplane
We are basically updating the location references everywhere with a
location id and adding the location relationship to the models to be
able to fetch location names when needed.
This also makes the LocationNameConverter model obsolete, so we are
removing it.

Use model id as value for Sequel::Model in resource creation form

Use id of the location as preselected value in Postgres update form
2025-03-23 15:48:19 +01:00

54 lines
1.3 KiB
Ruby

# frozen_string_literal: true
require_relative "../spec_helper"
RSpec.describe MinioCluster do
subject(:mc) {
mc = described_class.create_with_id(
location_id: Location::HETZNER_FSN1_ID,
name: "minio-cluster-name",
admin_user: "minio-admin",
admin_password: "dummy-password",
root_cert_1: "root_cert_1",
root_cert_2: "root_cert_2",
project_id: Project.create(name: "test").id
)
mp = MinioPool.create_with_id(
cluster_id: mc.id,
start_index: 0,
server_count: 1,
drive_count: 1,
storage_size_gib: 100,
vm_size: "standard-2"
)
MinioServer.create_with_id(
minio_pool_id: mp.id,
vm_id: create_vm.id,
index: 0
)
mc
}
it "returns minio servers properly" do
expect(mc.servers.map(&:index)).to eq([0])
end
it "returns per pool storage size properly" do
expect(mc.storage_size_gib).to eq(100)
end
it "returns per pool server count properly" do
expect(mc.server_count).to eq(1)
end
it "returns per pool driver count properly" do
expect(mc.drive_count).to eq(1)
end
it "returns connection strings properly" do
expect(mc.servers.first.vm).to receive(:ephemeral_net4).and_return("1.1.1.1")
expect(mc.ip4_urls).to eq(["https://1.1.1.1:9000"])
end
end