Commit 4daa93d9 authored by Dmitry Gruzd's avatar Dmitry Gruzd

Merge branch 'fix_version_for_external_installed' into 'master'

Set version when externally installed

See merge request gitlab-org/gitlab!58852
parents 72191923 a7270b34
......@@ -5,11 +5,17 @@ module Clusters
module ApplicationVersion
extend ActiveSupport::Concern
EXTERNAL_VERSION = 'EXTERNALLY_INSTALLED'
included do
state_machine :status do
before_transition any => [:installed, :updated] do |application|
application.version = application.class.const_get(:VERSION, false)
end
before_transition any => [:externally_installed] do |application|
application.version = EXTERNAL_VERSION
end
end
end
......
......@@ -47,4 +47,15 @@ RSpec.shared_examples 'cluster application version specs' do |application_name|
end
end
end
describe '#make_externally_installed' do
subject { build(application_name) }
it 'sets to a special version' do
subject.make_externally_installed!
expect(subject).to be_persisted
expect(subject.version).to eq('EXTERNALLY_INSTALLED')
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment