Remove hardcoding of mattermost home and add spec for it

This commit is contained in:
Balasankar C 2016-12-05 13:21:32 +05:30
parent b5460d7c02
commit ca96b4e9ba
No known key found for this signature in database
GPG Key ID: 96EDAB9B2E6B7171
2 changed files with 10 additions and 1 deletions

View File

@ -1,4 +1,4 @@
#!/bin/sh
exec 2>&1
cd /opt/gitlab/embedded/service/mattermost
exec chpst -P -U <%= node['gitlab']['mattermost']['username'] %> -u <%= node['gitlab']['mattermost']['username'] %> /opt/gitlab/embedded/bin/mattermost -config /var/opt/gitlab/mattermost/config.json
exec chpst -P -U <%= node['gitlab']['mattermost']['username'] %> -u <%= node['gitlab']['mattermost']['username'] %> /opt/gitlab/embedded/bin/mattermost -config <%= node['gitlab']['mattermost']['home'] %>/config.json

View File

@ -63,6 +63,15 @@ describe 'gitlab::mattermost' do
}
end
it 'creates mattermost configuration file in specified home folder' do
stub_gitlab_rb(mattermost: {
enable: true,
home: '/var/local/gitlab/mattermost',
})
expect(chef_run).to render_file('/opt/gitlab/sv/mattermost/run').with_content(/\-config \/var\/local\/gitlab\/mattermost\/config.json/)
end
shared_examples 'no gitlab authorization performed' do
it 'does not authorize mattermost with gitlab' do
expect(chef_run).to_not run_ruby_block('authorize mattermost with gitlab')