示例#1
0
def test_exit_ok(insights_config, insights_client):
    """
    Support collection replaces the normal client run.
    """
    with raises(SystemExit) as exc_info:
        update()
    assert exc_info.value.code == 0
示例#2
0
def test_update_payload_on(insights_config, insights_client):
    """
    Rules are not updated when a payload is uploaded
    """
    insights_config.return_value.load_all.return_value.payload = True
    try:
        update()
    except SystemExit:
        pass
    insights_client.return_value.update.assert_called_once()
    insights_client.return_value.update_rules.assert_not_called()
示例#3
0
def test_update_payload_off(insights_config, insights_client):
    """
    Rules are updated in normal operation (no payload)
    """
    insights_config.return_value.load_all.return_value.payload = False
    try:
        update()
    except SystemExit:
        pass
    insights_client.return_value.update.assert_called_once()
    insights_client.return_value.update_rules.assert_called_once()
示例#4
0
def test_update_core_collect_off(insights_config, insights_client):
    """
    Rules are updated when using classic collection
    """
    insights_config.return_value.load_all.return_value.payload = False
    insights_config.return_value.load_all.return_value.core_collect = False
    try:
        update()
    except SystemExit:
        pass
    insights_client.return_value.update.assert_called_once()
    insights_client.return_value.update_rules.assert_called_once()
示例#5
0
def test_update_core_collect_on(insights_config, insights_client):
    """
    Rules ARE updated when using core collection
    """
    insights_config.return_value.load_all.return_value.payload = False
    insights_config.return_value.load_all.return_value.core_collect = True
    try:
        update()
    except SystemExit:
        pass
    insights_client.return_value.update.assert_called_once()
    # we still want to download uploader.json because it's used
    #   for remove.conf component name resolution
    insights_client.return_value.update_rules.assert_called_once()
示例#6
0
    def worker():
        """
        Runs first two phases. Expected to be run in a subprocess. The update phase is expected to fail.
        """
        try:
            v1.pre_update()
        except SystemExit as exception:
            if exception.code:
                exit(1)  # This phase must not fail.
        else:
            exit(1)  # Phase did not exit.

        try:
            v1.update()
        except SystemExit as exception:
            if exception.code != 1:
                exit(1)  # Egg update is expected to fail.
        else:
            exit(1)  # Phase did not exit.