Bug 45377 - Test case 20_appcenter.100_settings.test fails in AD member mode tests
Test case 20_appcenter.100_settings.test fails in AD member mode tests
Status: NEW
Product: UCS Test
Classification: Unclassified
Component: App Center
unspecified
Other Linux
: P5 normal (vote)
: ---
Assigned To: App Center maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-09-10 14:42 CEST by Stefan Gohmann
Modified: 2017-11-14 16:20 CET (History)
1 user (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Gohmann univentionstaff 2017-09-10 14:42:27 CEST
The test case fails in various AD member mode setups, for example:

http://jenkins.knut.univention.de:8080/job/UCS-4.2/job/UCS-4.2-2/job/ADMemberMultiEnv/1/Mode=installation,Version=w2k8r2-english/testReport/20_appcenter/100_settings/test/

*** BEGIN *** ['/usr/bin/py.test', '100_settings.py'] ***
*** 20_appcenter/100_settings.py *** App Settings ***
*** START TIME: 2017-09-08 23:13:18 ***
============================= test session starts ==============================
platform linux2 -- Python 2.7.9 -- py-1.4.25 -- pytest-2.6.3
collected 9 items

100_settings.py .F..F.F..

=================================== FAILURES ===================================
__________________________ test_string_setting_docker __________________________

installed_apache_docker_app = App(id="apache", version="2.4", ucs_version="4.2", server="http://10.210.206.237")

    def test_string_setting_docker(installed_apache_docker_app):
    	content = '''[test/setting]
    Type = String
    Description = My Description
    InitialValue = Default: @%@ldap/base@%@
    Scope = inside, outside
    '''
    
    	app, settings = fresh_settings(content, installed_apache_docker_app, 1)
    	setting, = settings
    	assert repr(setting) == "StringSetting(name='test/setting')"
    
    	assert setting.is_inside(app) is True
    	assert setting.is_outside(app) is True
    
    	assert setting.get_initial_value() == 'Default: %s' % ucr_get('ldap/base')
    
    	assert setting.get_value(app) is None
    
    	with Configuring(app, revert='ucr') as config:
    		config.set({setting.name: 'My value'})
    		assert setting.get_value(app) == 'My value'
    		assert ucr_get(setting.name) == 'My value'
>   		assert docker_shell(app, 'grep "test/setting: " /etc/univention/base.conf') == 'test/setting: My value\n'

100_settings.py:206: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
100_settings.py:64: in docker_shell
    return subprocess.check_output(['docker', 'exec', container, '/bin/bash', '-c', command], stderr=subprocess.STDOUT)
/usr/lib/python2.7/subprocess.py:566: in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
/usr/lib/python2.7/subprocess.py:710: in __init__
    errread, errwrite)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <subprocess.Popen object at 0x7fef34e11b50>
args = ['docker', 'exec', None, '/bin/bash', '-c', 'grep "test/setting: " /etc/univention/base.conf']
executable = 'docker', preexec_fn = None, close_fds = False, cwd = None
env = None, universal_newlines = False, startupinfo = None, creationflags = 0
shell = False, to_close = set([16]), p2cread = None, p2cwrite = None
c2pread = 16, c2pwrite = 17, errread = None, errwrite = 17

    def _execute_child(self, args, executable, preexec_fn, close_fds,
                       cwd, env, universal_newlines,
                       startupinfo, creationflags, shell, to_close,
                       p2cread, p2cwrite,
                       c2pread, c2pwrite,
                       errread, errwrite):
        """Execute program (POSIX version)"""
    
        if isinstance(args, types.StringTypes):
            args = [args]
        else:
            args = list(args)
    
        if shell:
            args = ["/bin/sh", "-c"] + args
            if executable:
                args[0] = executable
    
        if executable is None:
            executable = args[0]
    
        def _close_in_parent(fd):
            os.close(fd)
            to_close.remove(fd)
    
        # For transferring possible exec failure from child to parent
        # The first char specifies the exception type: 0 means
        # OSError, 1 means some other error.
        errpipe_read, errpipe_write = self.pipe_cloexec()
        try:
            try:
                gc_was_enabled = gc.isenabled()
                # Disable gc to avoid bug where gc -> file_dealloc ->
                # write to stderr -> hang.  http://bugs.python.org/issue1336
                gc.disable()
                try:
                    self.pid = os.fork()
                except:
                    if gc_was_enabled:
                        gc.enable()
                    raise
                self._child_created = True
                if self.pid == 0:
                    # Child
                    try:
                        # Close parent's pipe ends
                        if p2cwrite is not None:
                            os.close(p2cwrite)
                        if c2pread is not None:
                            os.close(c2pread)
                        if errread is not None:
                            os.close(errread)
                        os.close(errpipe_read)
    
                        # When duping fds, if there arises a situation
                        # where one of the fds is either 0, 1 or 2, it
                        # is possible that it is overwritten (#12607).
                        if c2pwrite == 0:
                            c2pwrite = os.dup(c2pwrite)
                        if errwrite == 0 or errwrite == 1:
                            errwrite = os.dup(errwrite)
    
                        # Dup fds for child
                        def _dup2(a, b):
                            # dup2() removes the CLOEXEC flag but
                            # we must do it ourselves if dup2()
                            # would be a no-op (issue #10806).
                            if a == b:
                                self._set_cloexec_flag(a, False)
                            elif a is not None:
                                os.dup2(a, b)
                        _dup2(p2cread, 0)
                        _dup2(c2pwrite, 1)
                        _dup2(errwrite, 2)
    
                        # Close pipe fds.  Make sure we don't close the
                        # same fd more than once, or standard fds.
                        closed = { None }
                        for fd in [p2cread, c2pwrite, errwrite]:
                            if fd not in closed and fd > 2:
                                os.close(fd)
                                closed.add(fd)
    
                        if cwd is not None:
                            os.chdir(cwd)
    
                        if preexec_fn:
                            preexec_fn()
    
                        # Close all other fds, if asked for - after
                        # preexec_fn(), which may open FDs.
                        if close_fds:
                            self._close_fds(but=errpipe_write)
    
                        if env is None:
                            os.execvp(executable, args)
                        else:
                            os.execvpe(executable, args, env)
    
                    except:
                        exc_type, exc_value, tb = sys.exc_info()
                        # Save the traceback and attach it to the exception object
                        exc_lines = traceback.format_exception(exc_type,
                                                               exc_value,
                                                               tb)
                        exc_value.child_traceback = ''.join(exc_lines)
                        os.write(errpipe_write, pickle.dumps(exc_value))
    
                    # This exitcode won't be reported to applications, so it
                    # really doesn't matter what we return.
                    os._exit(255)
    
                # Parent
                if gc_was_enabled:
                    gc.enable()
            finally:
                # be sure the FD is closed no matter what
                os.close(errpipe_write)
    
            # Wait for exec to fail or succeed; possibly raising exception
            # Exception limited to 1M
            data = _eintr_retry_call(os.read, errpipe_read, 1048576)
        finally:
            if p2cread is not None and p2cwrite is not None:
                _close_in_parent(p2cread)
            if c2pwrite is not None and c2pread is not None:
                _close_in_parent(c2pwrite)
            if errwrite is not None and errread is not None:
                _close_in_parent(errwrite)
    
            # be sure the FD is closed no matter what
            os.close(errpipe_read)
    
        if data != "":
            try:
                _eintr_retry_call(os.waitpid, self.pid, 0)
            except OSError as e:
                if e.errno != errno.ECHILD:
                    raise
            child_exception = pickle.loads(data)
>           raise child_exception
E           TypeError: execv() arg 2 must contain only strings

/usr/lib/python2.7/subprocess.py:1335: TypeError
---------------------------- Captured stdout setup -----------------------------
Downloading "http://10.210.206.237/meta-inf/categories.ini"...
Downloading "http://10.210.206.237/meta-inf/rating.ini"...
Downloading "http://10.210.206.237/meta-inf/license_types.ini"...
Downloading "http://10.210.206.237/meta-inf/ucs.ini"...
Downloading "http://10.210.206.237/meta-inf/4.2/index.json.gz"...
Downloading "http://10.210.206.237/meta-inf/4.2/all.tar.zsync"...
Downloading "http://10.210.206.237/meta-inf/4.1/index.json.gz"...
Component is: apache_20170908
Going to install Apache (2.4)
---------------------------- Captured stderr setup -----------------------------
http://10.210.206.237/meta-inf/4.1/index.json.gz could not be downloaded. This seems to be a problem with the App Center server. Please try again later.
(must_have_valid_license) For the installation of this application, a UCS license key
		with a key identification (Key ID) is required
Unable to install apache. Aborting...
----------------------------- Captured stdout call -----------------------------
Downloading "http://10.210.206.237/meta-inf/categories.ini"...
Downloading "http://10.210.206.237/meta-inf/rating.ini"...
Downloading "http://10.210.206.237/meta-inf/license_types.ini"...
Downloading "http://10.210.206.237/meta-inf/ucs.ini"...
Downloading "http://10.210.206.237/meta-inf/4.2/index.json.gz"...
Downloading "http://10.210.206.237/meta-inf/4.2/all.tar.zsync"...
Downloading "http://10.210.206.237/meta-inf/4.1/index.json.gz"...
Component is: apache_20170908
Configuring apache=2.4
Setting test/setting to 'My value'
----------------------------- Captured stderr call -----------------------------
http://10.210.206.237/meta-inf/4.1/index.json.gz could not be downloaded. This seems to be a problem with the App Center server. Please try again later.
Cannot write settings while apache=2.4 is not running
___________________________ test_file_setting_docker ___________________________

installed_apache_docker_app = App(id="apache", version="2.4", ucs_version="4.2", server="http://10.210.206.237")

    def test_file_setting_docker(installed_apache_docker_app):
    	content = '''[test/setting4]
    Type = File
    Filename = /tmp/settingdir/setting4.test
    Description = My Description 4
    '''
    
    	app, settings = fresh_settings(content, installed_apache_docker_app, 1)
    	setting, = settings
    	assert repr(setting) == "FileSetting(name='test/setting4')"
    
    	docker_file = Docker(app).path(setting.filename)
    
    	try:
    		with Configuring(app, revert='configure') as config:
>   			assert not os.path.exists(docker_file)

100_settings.py:312: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

path = None

    def exists(path):
        """Test whether a path exists.  Returns False for broken symbolic links"""
        try:
>           os.stat(path)
E           TypeError: coercing to Unicode: need string or buffer, NoneType found

/usr/lib/python2.7/genericpath.py:18: TypeError
---------------------------- Captured stdout setup -----------------------------
Going to install Apache (2.4)
---------------------------- Captured stderr setup -----------------------------
(must_have_valid_license) For the installation of this application, a UCS license key
		with a key identification (Key ID) is required
Unable to install apache. Aborting...
----------------------------- Captured stdout call -----------------------------
Downloading "http://10.210.206.237/meta-inf/categories.ini"...
Downloading "http://10.210.206.237/meta-inf/rating.ini"...
Downloading "http://10.210.206.237/meta-inf/license_types.ini"...
Downloading "http://10.210.206.237/meta-inf/ucs.ini"...
Downloading "http://10.210.206.237/meta-inf/4.2/index.json.gz"...
Downloading "http://10.210.206.237/meta-inf/4.2/all.tar.zsync"...
Downloading "http://10.210.206.237/meta-inf/4.1/index.json.gz"...
Component is: apache_20170908
Configuring apache=2.4
----------------------------- Captured stderr call -----------------------------
http://10.210.206.237/meta-inf/4.1/index.json.gz could not be downloaded. This seems to be a problem with the App Center server. Please try again later.
_________________________ test_password_setting_docker _________________________

installed_apache_docker_app = App(id="apache", version="2.4", ucs_version="4.2", server="http://10.210.206.237")

    def test_password_setting_docker(installed_apache_docker_app):
    	content = '''[test/setting5]
    Type = Password
    
    [test/setting6]
    Type = PasswordFile
    Filename = /tmp/settingdir/setting6.password
    '''
    
    	app, settings = fresh_settings(content, installed_apache_docker_app, 2)
    	password_setting, password_file_setting = settings
    
    	assert repr(password_setting) == "PasswordSetting(name='test/setting5')"
    	assert repr(password_file_setting) == "PasswordFileSetting(name='test/setting6')"
    
    	assert password_setting.should_go_into_image_configuration(app) is False
    	assert password_file_setting.should_go_into_image_configuration(app) is False
    
    	password_file = Docker(app).path(password_file_setting.filename)
    
    	assert password_setting.is_inside(app) is True
    	assert password_file_setting.is_inside(app) is True
    
>   	assert not os.path.exists(password_file)

100_settings.py:389: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

path = None

    def exists(path):
        """Test whether a path exists.  Returns False for broken symbolic links"""
        try:
>           os.stat(path)
E           TypeError: coercing to Unicode: need string or buffer, NoneType found

/usr/lib/python2.7/genericpath.py:18: TypeError
---------------------------- Captured stdout setup -----------------------------
Going to install Apache (2.4)
---------------------------- Captured stderr setup -----------------------------
(must_have_valid_license) For the installation of this application, a UCS license key
		with a key identification (Key ID) is required
Unable to install apache. Aborting...
----------------------------- Captured stdout call -----------------------------
Downloading "http://10.210.206.237/meta-inf/categories.ini"...
Downloading "http://10.210.206.237/meta-inf/rating.ini"...
Downloading "http://10.210.206.237/meta-inf/license_types.ini"...
Downloading "http://10.210.206.237/meta-inf/ucs.ini"...
Downloading "http://10.210.206.237/meta-inf/4.2/index.json.gz"...
Downloading "http://10.210.206.237/meta-inf/4.2/all.tar.zsync"...
Downloading "http://10.210.206.237/meta-inf/4.1/index.json.gz"...
Component is: apache_20170908
----------------------------- Captured stderr call -----------------------------
http://10.210.206.237/meta-inf/4.1/index.json.gz could not be downloaded. This seems to be a problem with the App Center server. Please try again later.
===================== 3 failed, 6 passed in 40.02 seconds ======================
*** END TIME: 2017-09-08 23:13:59 ***
*** TEST DURATION (H:MM:SS.ms): 0:00:40.402300 ***
*** END *** 1 ***
Comment 1 Stefan Gohmann univentionstaff 2017-09-10 14:55:39 CEST
I've disabled the test case in AD member mode, please re-enable the test case once the issue has been fixed.