Commit 2d221178 authored by Jamie Tanna's avatar Jamie Tanna

Fix: create group before assigning user

As found in our integration test, we need to have our group created
_before_ we can put a user into it.
parent 80a2c5e5
Pipeline #8517374 passed with stage
in 1 minute and 39 seconds
......@@ -17,6 +17,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
group 'create the group' do
group_name node['group']
not_if { node['group'].nil? }
end
user "create user #{node['user']}" do
username node['user']
group node['group']
......
......@@ -32,6 +32,10 @@ describe 'user-cookbook::default' do
expect { chef_run }.to_not raise_error
end
it 'doesn\'t create the users group' do
expect(chef_run).to_not create_group('create the group')
end
it 'creates the jamie user' do
expect(chef_run).to create_user('create user jamie')
.with(username: 'jamie')
......@@ -55,6 +59,10 @@ describe 'user-cookbook::default' do
expect { chef_run }.to_not raise_error
end
it 'doesn\'t create the users group' do
expect(chef_run).to_not create_group('create the group')
end
it 'creates the test user' do
expect(chef_run).to create_user('create user test')
.with(username: 'test')
......@@ -79,6 +87,11 @@ describe 'user-cookbook::default' do
expect { chef_run }.to_not raise_error
end
it 'creates the users group' do
expect(chef_run).to create_group('create the group')
.with(group_name: 'users')
end
it 'creates the test user' do
expect(chef_run).to create_user('create user test')
.with(username: 'test')
......@@ -103,6 +116,10 @@ describe 'user-cookbook::default' do
expect { chef_run }.to_not raise_error
end
it 'doesn\'t create the users group' do
expect(chef_run).to_not create_group('create the group')
end
it 'creates the hello.txt file' do
expect(chef_run).to create_file('creates the hello.txt file')
.with(path: '~jamie/hello.txt')
......
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