Files
ubicloud/spec/model/github_installation_spec.rb
Jeremy Evans e6b7e5e879 Change rubocop TargetRubyVersion to 3.4
Disable Style/RedundantLineContinuation, as it incorrectly removes
line continutations in rhizome/host/lib/vm_setup.rb that are not
redundant.

All code changes are for _1 => it in blocks.
2025-04-26 06:51:19 +09:00

35 lines
1.2 KiB
Ruby

# frozen_string_literal: true
require_relative "spec_helper"
RSpec.describe GithubInstallation do
subject(:installation) {
project = Project.create_with_id(name: "default")
described_class.create_with_id(installation_id: 123, project_id: project.id, name: "test-user", type: "User")
}
it "returns sum of used vm cores" do
vms = [2, 4, 8].map { create_vm(cores: it) }
# let's not create runner for the last vm
vms[..1].each do |vm|
gr = GithubRunner.create_with_id(installation_id: installation.id, vm_id: vm.id, repository_name: "test-repo", label: "ubicloud-standard-#{vm.cores}")
Strand.create(prog: "Github::RunnerNexus", label: "allocate_vm") { it.id = gr.id }
end
expect(installation.total_active_runner_vcpus).to eq(6)
end
it "returns sum of used vm cores for arm64" do
vms = [2, 4].map { create_vm(cores: it, arch: "arm64") }
vms.each do |vm|
gr = GithubRunner.create_with_id(installation_id: installation.id, vm_id: vm.id, repository_name: "test-repo", label: "ubicloud-standard-#{vm.cores}-arm")
Strand.create(prog: "Github::RunnerNexus", label: "allocate_vm") { it.id = gr.id }
end
expect(installation.total_active_runner_vcpus).to eq(6)
end
end