Exemple #1
0
def test_nomad_agent_deploy_flows(monkeypatch):
    requests = MagicMock()
    monkeypatch.setattr("prefect.agent.nomad.agent.requests", requests)

    with set_temporary_config({"cloud.agent.auth_token": "token"}):
        agent = NomadAgent()
        agent.deploy_flows(flow_runs=[
            GraphQLResult({
                "flow":
                GraphQLResult({
                    "storage":
                    Docker(
                        registry_url="test",
                        image_name="name",
                        image_tag="tag",
                    ).serialize(),
                    "id":
                    "id",
                }),
                "id":
                "id",
            })
        ])

    assert requests.post.called
    assert requests.post.call_args[1]["json"]
Exemple #2
0
def test_nomad_agent_deploy_flows_continues(monkeypatch, runner_token):
    requests = MagicMock()
    monkeypatch.setattr("prefect.agent.nomad.agent.requests", requests)

    agent = NomadAgent()
    agent.deploy_flows(flow_runs=[
        GraphQLResult(
            {
                "flow": GraphQLResult({
                    "storage": Local().serialize(),
                    "id": "id"
                }),
                "id": "id",
            })
    ])

    assert not requests.post.called