Skip to content

Commit

Permalink
update 0004_start_test.py - postart script executable
Browse files Browse the repository at this point in the history
  • Loading branch information
Defenso-QTH committed Nov 18, 2024
1 parent 32ca81f commit c191e7d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tests/functional_tests/0004_start_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def test_03_create_and_start_nobridge_vnet_jail(release, jail, invoke_cli, nobri
iface=vnet0.$jid
ifconfig $iface inet6 fe80::1/64
"""))
os.chmod(path, 0o755)

invoke_cli([

Check failure on line 81 in tests/functional_tests/0004_start_test.py

View check run for this annotation

Cirrus CI / Use prebuilt packages

tests/functional_tests/0004_start_test.py#L81

tests.functional_tests.0004_start_test.test_03_create_and_start_nobridge_vnet_jail
Raw output
release = '14.1-RELEASE', jail = nobridge_jail
invoke_cli = <function invoke_cli.<locals>.invoke at 0x15f6820484a0>
nobridge_jail_ip = '192.168.2.2'

    @require_root
    @require_zpool
    @require_nobridge_jail_ip
    def test_03_create_and_start_nobridge_vnet_jail(release, jail, invoke_cli, nobridge_jail_ip):
        jail = jail('nobridge_jail')
    
        fd, path = tempfile.mkstemp()
    
        try:
            with os.fdopen(fd, 'w') as tmp:
                tmp.write(inspect.cleandoc("""
                    #!/bin/sh
                    jailname=ioc-$1
                    jid=jls -j $jailname jid
                    iface=vnet0.$jid
                    ifconfig $iface inet6 fe80::1/64
                """))
            os.chmod(path, 0o755)
    
>           invoke_cli([
                'create', '-r', release, '-n', jail.name,
                f'ip4_addr=lo0|{nobridge_jail_ip}', 'boot=on', 'vnet=on',
                'interfaces=vnet0:none', 'vnet_default_interface=none',
                'ip6_addr=vnet0|fe80::2/64', 'defaultrouter6=none',
                'defaultrouter=none',
                f'exec_poststart="{path} {jail.name}"'
            ])

tests/functional_tests/0004_start_test.py:81: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cmd = ['iocage', 'create', '-r', '14.1-RELEASE', '-n', 'nobridge_jail', ...]
reason = '  + Executing exec_poststart FAILED\nERROR:\nScript is not executable!\n\nRefusing to start nobridge_jail: exec_poststart failed\n'
assert_returncode = True

    def invoke(cmd, reason=None, assert_returncode=True):
        cmd.insert(0, 'iocage')
        cmd = [str(c) for c in cmd]
    
        result = subprocess.run(
            cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE
        )
        reason = f'{reason}: {result.stderr}' if reason else result.stderr
    
        if assert_returncode:
            # Empty or Template jails that should not be started/stopped but
            # sometimes make it in due to a race
            try:
                reason = reason.decode()
            except AttributeError:
                pass
    
            if 'execvp: /bin/sh: No such' not in reason:
>               assert result.returncode == 0, reason
E               AssertionError:   + Executing exec_poststart FAILED
E                 ERROR:
E                 Script is not executable!
E                 
E                 Refusing to start nobridge_jail: exec_poststart failed
E                 
E               assert 1 == 0
E                +  where 1 = CompletedProcess(args=['iocage', 'create', '-r', '14.1-RELEASE', '-n', 'nobridge_jail', 'ip4_addr=lo0|192.168.2.2', 'boot=on', 'vnet=on', 'interfaces=vnet0:none', 'vnet_default_interface=none', 'ip6_addr=vnet0|fe80::2/64', 'defaultrouter6=none', 'defaultrouter=none', 'exec_poststart="/tmp/tmppsj51bj3 nobridge_jail"'], returncode=1, stdout=b'nobridge_jail successfully created!\n* Starting nobridge_jail\n  + Started OK\n  + Using devfs_ruleset: 1012 (iocage generated default)\n  + Configuring VNET OK\n  + Using IP options: vnet\n  + Starting services OK\n', stderr=b'  + Executing exec_poststart FAILED\nERROR:\nScript is not executable!\n\nRefusing to start nobridge_jail: exec_poststart failed\n').returncode

tests/conftest.py:293: AssertionError
'create', '-r', release, '-n', jail.name,
Expand Down

0 comments on commit c191e7d

Please sign in to comment.