Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ def self.verify_instance(request, logger, system)
cache_params = {}
# we are checking the base product so we pick the first registration code
# PAYG instances have no registration code
cache_params = { token: Base64.decode64(system.pubcloud_reg_code.split(',')[0]), instance_data: decoded_instance_data } unless system.payg?
unless system.payg? || system.pubcloud_reg_code.blank?
cache_params = { token: Base64.decode64(system.pubcloud_reg_code.split(',')[0]),
instance_data: decoded_instance_data }
end
cache_key = InstanceVerification.build_cache_entry(
request.remote_ip, system.login, cache_params, system.proxy_byos_mode, base_product
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
repo_items.map { |r| r.attr(:url) }
end

let(:system) { FactoryBot.create(:system, :with_activated_product) }
let(:system) { FactoryBot.create(:system, :byos, :with_activated_product) }
let(:service) { system.products.first.service }

context 'without X-Instance-Data header' do
Expand Down Expand Up @@ -58,6 +58,11 @@

context 'when instance verification returns false' do
before do
stub_request(:get, 'https://scc.suse.com/connect/systems/activations')
.to_return(status: 200, body: '', headers: {})
expect(InstanceVerification).to receive(:build_cache_entry).with(
'127.0.0.1', system.login, {}, system.proxy_byos_mode, system.products.find_by(product_type: 'base')
)
get "/services/#{service.id}", headers: headers
end

Expand Down