Example #1
0
def test_instance_too_small_gcp():
    """Test that using too small an instance triggers an error"""
    args = argparse.Namespace(
        cfg=os.path.join(TEST_DATA_DIR, 'instance-too-small-gcp.ini'))
    with pytest.raises(UserReportError) as err:
        cfg = ElasticBlastConfig(configure(args), task=ElbCommand.SUBMIT)
        cfg.validate()
    assert err.value.returncode == INPUT_ERROR
    print(err.value.message)
    assert 'does not have enough memory' in err.value.message
Example #2
0
def test_validate_too_many_cpus():
    """Test that requesting too many CPUs is reported"""
    cfg = ElasticBlastConfig(aws_region='test-region',
                             program='blastn',
                             db='test-db',
                             queries='test-query.fa',
                             results='s3://results',
                             task=ElbCommand.SUBMIT)
    cfg.cluster.machine_type = 'm5.large'
    cfg.cluster.num_cpus = 16

    with pytest.raises(UserReportError) as err:
        cfg.validate(ElbCommand.SUBMIT)
    assert re.search(r'number of CPUs [\w "]* exceeds', str(err.value))