X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/4b037a38dbe848a77224dd05dd035736b5d0c0c1..b84947c1681c49ef1c1e9c29d1d19825c8868500:/services/login-sync/test/test_add_user.rb?ds=inline diff --git a/services/login-sync/test/test_add_user.rb b/services/login-sync/test/test_add_user.rb index caaadd5fc9..17942c2cff 100644 --- a/services/login-sync/test/test_add_user.rb +++ b/services/login-sync/test/test_add_user.rb @@ -1,3 +1,7 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + require 'minitest/autorun' require 'stubs' @@ -11,21 +15,24 @@ class TestAddUser < Minitest::Test File.open(@tmpdir+'/succeed', 'w') do |f| end invoke_sync binstubs: ['new_user'] spied = File.read(@tmpdir+'/spy') - assert_match %r{useradd -m -c active -s /bin/bash -G fuse active}, spied + assert_match %r{useradd -m -c active -s /bin/bash -G (fuse)? active}, spied # BUG(TC): This assertion succeeds only if docker and fuse groups # exist on the host, but is insensitive to the admin group (groups # are quietly ignored by login-sync if they don't exist on the # current host). - assert_match %r{useradd -m -c adminroot -s /bin/bash -G docker(,admin)?,fuse adminroot}, spied + assert_match %r{useradd -m -c adminroot -s /bin/bash -G (docker)?(,admin)?(,fuse)? adminroot}, spied end def test_useradd_success # binstub_new_user/useradd will succeed. File.open(@tmpdir+'/succeed', 'w') do |f| f.puts 'useradd -m -c active -s /bin/bash -G fuse active' + f.puts 'useradd -m -c active -s /bin/bash -G active' # Accept either form; see note about groups in test_useradd_error. f.puts 'useradd -m -c adminroot -s /bin/bash -G docker,fuse adminroot' f.puts 'useradd -m -c adminroot -s /bin/bash -G docker,admin,fuse adminroot' + f.puts 'useradd -m -c adminroot -s /bin/bash -G docker adminroot' + f.puts 'useradd -m -c adminroot -s /bin/bash -G docker,admin adminroot' end $stderr.puts "*** Expect crash after getpwnam() fails:" invoke_sync binstubs: ['new_user']