Exemplo n.º 1
0
def test_ls_run(os):

    # Set up args
    args = argparse.Namespace()
    args.containerId = 'testContainerId'
    args.shell = '/bin/bash'
    args.allow_network = False
    args.unlimited_memory = False
    args.super_user = False
    args.no_rm = False

    # Run the command
    inspect.command_inspect(args)

    # Verify correct command output
    os.execvp.assert_called_with('docker', [
        'docker',
        'run',
        '-it',
        '--entrypoint',
        '/bin/bash',
        '--net',
        'none',
        '-m',
        '1g',
        '--rm',
        '-u',
        '1000',
        'testContainerId',
    ])
Exemplo n.º 2
0
def test_ls_run(os):

    # Set up args
    args = argparse.Namespace()
    args.containerId = 'testContainerId'
    args.shell = '/bin/bash'
    args.allow_network = False
    args.unlimited_memory = False
    args.super_user = False

    # Run the command
    inspect.command_inspect(args)

    # Verify correct command output
    os.execvp.assert_called_with('docker', [
        'docker',
        'run',
        '-it',
        '--entrypoint',
        '/bin/bash',
        '--net',
        'none',
        '-m',
        '1g',
        '-u',
        '1000',
        'testContainerId',
    ])
def test_ls_run_without_limits(os):

    # Set up args
    args = argparse.Namespace()
    args.containerId = 'testContainerId'
    args.shell = '/bin/bash'
    args.allow_network = True
    args.unlimited_memory = True
    args.super_user = True

    # Run the command
    inspect.command_inspect(args)

    # Verify correct command output
    os.execvp.assert_called_with('docker', [
        'docker',
        'run',
        '-it',
        '--entrypoint',
        '/bin/bash',
        'testContainerId',
    ])
Exemplo n.º 4
0
def test_ls_run_without_limits(os):

    # Set up args
    args = argparse.Namespace()
    args.imageId = 'testImageId'
    args.shell = '/bin/bash'
    args.allow_network = True
    args.unlimited_memory = True
    args.super_user = True
    args.no_rm = True

    # Run the command
    inspect.command_inspect(args)

    # Verify correct command output
    os.execvp.assert_called_with('docker', [
        'docker',
        'run',
        '-it',
        '--entrypoint',
        '/bin/bash',
        'testImageId',
    ])