Exemplo n.º 1
0
def test_build_url():
    filepath = 'https://raw.githubusercontent.com/nuclio/nuclio/master/hack/' \
               + 'examples/java/empty/EmptyHandler.java'

    name, config, code = build_file(filepath, name='javatst', output_dir='.')

    assert name == 'javatst', 'build failed, name doesnt match={}'.format(name)
    assert config.get('spec'), 'build failed, config={}'.format(config)
    assert get_in(config, 'spec.runtime') == 'java', 'not java runtime'
Exemplo n.º 2
0
def test_build_file_nb():
    filepath = '{}/handler.ipynb'.format(here)
    filepath = filepath.replace("\\", "/")  # handle windows
    spec = ConfigSpec(config={'spec.maxReplicas': 2})
    name, config, code = build_file(filepath, spec=spec)

    assert name == 'handler', 'build failed, name doesnt match={}'.format(name)
    assert config.get('spec'), 'build failed, config={}'.format(config)

    maxRep = get_in(config, 'spec.maxReplicas')
    assert maxRep == 2, 'failed to set replicas, {}'.format(maxRep)
Exemplo n.º 3
0
def test_build_url(url_filepath):
    name, config, code = build_file(url_filepath,
                                    name='javatst',
                                    output_dir='.')

    assert name == 'javatst', 'build failed, name doesnt match={}'.format(name)
    assert config.get('spec'), 'build failed, config={}'.format(config)
    assert get_in(config, 'spec.runtime') == 'java', 'not java runtime'
    assert os.path.exists('EmptyHandler.java'), \
        'EmptyHandler.java file was not created'
    assert os.path.exists('function.yaml'), \
        'function.yaml file was not created'