def test__run__syntax_error__fail(controller, goss_sut_service):
    sut = goss_sut_service

    g = GossTool(controller, sut)
    g._command = '/goss/goss-linux-amd64 /data'

    with pytest.raises(TestToolError, match='Syntax error'):
        g.run(target)
def test__run__gossfile_not_found__fail(controller, goss_sut_service):
    sut = goss_sut_service

    g = GossTool(controller, sut)
    g.gossfile = 'bla'

    with pytest.raises(TestToolError, match='Gossfile not found'):
        g.run(target)
def test__run__goss_not_found__fail(controller, goss_sut_service):
    sut = goss_sut_service

    g = GossTool(controller, sut)
    g._command = 'not_existing'

    with pytest.raises(TestToolError, match='goss executable was not found'):
        g.run(target)
def test__run__pass(controller, gossfile, goss_sut_service):
    sut = goss_sut_service

    controller.put_file(sut.target, gossfile)
    g = GossTool(controller, sut, gossfile=os.path.basename(gossfile))
    res = g.run(target)

    assert res['summary']['failed-count'] == 1