SaltDns.Resolver.Fake (Salt v1.0.0)

A resolver for tests: answers come from a table you fill.

start_supervised!(SaltDns.Resolver.Fake)
Fake.put(:delegation, "example.com", ["ns1.salt.test", "ns2.salt.test"])
Fake.put(:txt, "_salt-dns-challenge.example.com", {:error, :timeout})

Names without an entry answer {:ok, []} (for ds/1, {:error, :unavailable}: put a SaltDns.Resolver.ds_result() or an error). calls/0 lists the questions asked, oldest first. Select it with Application.put_env(:salt_dns, :resolver, SaltDns.Resolver.Fake).

Summary

Functions

The questions asked so far, as {type, name}.

Returns a specification to start this module under a supervisor.

Sets the answer for a question: a list of strings, {:ok, list} or {:error, reason}.

Forgets the table and the calls.

Functions

calls()

The questions asked so far, as {type, name}.

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

put(type, name, answer)

Sets the answer for a question: a list of strings, {:ok, list} or {:error, reason}.

reset()

Forgets the table and the calls.

start_link(opts \\ [])