func fakeDNS(port int) (*Resolver, error) { res := New("", records.Config{ Masters: []string{"144.76.157.37:5050"}, TTL: 60, Port: port, Domain: "mesos", Resolvers: records.GetLocalDNS(), Listener: "127.0.0.1", SOARname: "root.ns1.mesos.", SOAMname: "ns1.mesos.", HTTPPort: 8123, ExternalOn: true, }) b, err := ioutil.ReadFile("../factories/fake.json") if err != nil { return res, err } var sj records.StateJSON err = json.Unmarshal(b, &sj) if err != nil { return res, err } masters := []string{"144.76.157.37:5050"} spec := labels.ForRFC952() res.rs = &records.RecordGenerator{} res.rs.InsertState(sj, "mesos", "mesos-dns.mesos.", "127.0.0.1", masters, spec) return res, nil }
func fakeDNS(t *testing.T) *Resolver { res := New("", records.Config{ Masters: []string{"144.76.157.37:5050"}, TTL: 60, Port: 53, Domain: "mesos", Resolvers: records.GetLocalDNS(), Listener: "127.0.0.1", SOARname: "root.ns1.mesos.", SOAMname: "ns1.mesos.", HTTPPort: 8123, ExternalOn: true, EnforceRFC952: true, }) res.rng.Seed(0) // for deterministic tests b, err := ioutil.ReadFile("../factories/fake.json") if err != nil { t.Fatal(err) } var sj state.State err = json.Unmarshal(b, &sj) if err != nil { t.Fatal(err) } spec := labels.RFC952 err = res.rs.InsertState(sj, "mesos", "mesos-dns.mesos.", "127.0.0.1", res.config.Masters, spec) if err != nil { t.Fatal(err) } return res }