Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d20a077096 |
@@ -15,7 +15,8 @@ import (
|
|||||||
// same arrangement, and to the two things a resolver here must never do — read resolv.conf for
|
// same arrangement, and to the two things a resolver here must never do — read resolv.conf for
|
||||||
// its upstreams, or take an address systemd-resolved holds.
|
// its upstreams, or take an address systemd-resolved holds.
|
||||||
|
|
||||||
// resolverShelf is the three resolver modules beside something that answers `mesh-addressing`.
|
// resolverShelf is the three resolver modules and the container runtime beside something that
|
||||||
|
// answers `mesh-addressing`.
|
||||||
// The networking module that really does is composed in the controller and cannot be imported
|
// The networking module that really does is composed in the controller and cannot be imported
|
||||||
// here, so a stand-in offers the same word; what is under test is the manifests, not the network.
|
// here, so a stand-in offers the same word; what is under test is the manifests, not the network.
|
||||||
func resolverShelf(t *testing.T) map[string]Manifest {
|
func resolverShelf(t *testing.T) map[string]Manifest {
|
||||||
@@ -23,7 +24,7 @@ func resolverShelf(t *testing.T) map[string]Manifest {
|
|||||||
shelf := map[string]Manifest{
|
shelf := map[string]Manifest{
|
||||||
"net": {Module: "net", Version: "1", Provides: []Offer{{Name: "mesh-addressing"}}},
|
"net": {Module: "net", Version: "1", Provides: []Offer{{Name: "mesh-addressing"}}},
|
||||||
}
|
}
|
||||||
for _, name := range []string{"dnsmasq", "resolv-conf", "resolved-split-dns"} {
|
for _, name := range []string{"dnsmasq", "resolv-conf", "resolved-split-dns", "docker"} {
|
||||||
shelf[name] = catalogueManifest(t, name)
|
shelf[name] = catalogueManifest(t, name)
|
||||||
}
|
}
|
||||||
return shelf
|
return shelf
|
||||||
@@ -117,8 +118,9 @@ func TestTheResolverForwardsToFixedUpstreamsAndNeverReadsResolvConf(t *testing.T
|
|||||||
// that file, the machine pointed at the resolver by address, and the runtime given no resolver of
|
// that file, the machine pointed at the resolver by address, and the runtime given no resolver of
|
||||||
// its own but kept running across a restart (ADR 0196).
|
// its own but kept running across a restart (ADR 0196).
|
||||||
func TestTheResolverAndWhatAsksItComposeOnOneMachine(t *testing.T) {
|
func TestTheResolverAndWhatAsksItComposeOnOneMachine(t *testing.T) {
|
||||||
got, err := Resolve(resolverShelf(t), []string{"dnsmasq", "resolv-conf"},
|
got, err := Resolve(resolverShelf(t), []string{"dnsmasq", "resolv-conf", "docker"},
|
||||||
Node{Name: "anchor", At: "anchor.internal"}, World{})
|
Node{Name: "anchor", At: "anchor.internal", Capabilities: map[string]bool{
|
||||||
|
"package-manager": true, "service-manager": true, "privileged": true}}, World{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -167,13 +169,19 @@ func TestTheResolverAndWhatAsksItComposeOnOneMachine(t *testing.T) {
|
|||||||
t.Errorf("the resolver was not told to forward the zone to its answerer:\n%s", z)
|
t.Errorf("the resolver was not told to forward the zone to its answerer:\n%s", z)
|
||||||
}
|
}
|
||||||
|
|
||||||
// The runtime's own file, written into (novox/hq ADR 0102) with one key, by what decides how the
|
// The runtime's own file, written into (novox/hq ADR 0102) with one key, by the runtime's own
|
||||||
// machine resolves: a restart keeps every container running. No `dns` — a container copies its
|
// module — a module does not write another software's configuration (issue 190): a restart keeps
|
||||||
// machine's resolvers (ADR 0196), and the mesh's resolver is not written into the runtime twice.
|
// every container running. No `dns` — a container copies its machine's resolvers (ADR 0196), and
|
||||||
|
// neither the resolver nor what decides how the machine resolves writes the runtime's file.
|
||||||
if ids["dnsmasq.runtime-dns"] != nil {
|
if ids["dnsmasq.runtime-dns"] != nil {
|
||||||
t.Errorf("the resolver still writes the runtime's dns: %v", ids["dnsmasq.runtime-dns"])
|
t.Errorf("the resolver still writes the runtime's dns: %v", ids["dnsmasq.runtime-dns"])
|
||||||
}
|
}
|
||||||
runtime := ids["resolv-conf.runtime-config"]
|
for id := range ids {
|
||||||
|
if strings.HasPrefix(id, "resolv-conf.runtime") {
|
||||||
|
t.Errorf("what the machine asks still writes the runtime's file: %s", id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
runtime := ids["docker.daemon"]
|
||||||
if runtime == nil || runtime["path"] != "/etc/docker/daemon.json" || runtime["into"] != "json" {
|
if runtime == nil || runtime["path"] != "/etc/docker/daemon.json" || runtime["into"] != "json" {
|
||||||
t.Fatalf("live-restore is not written into the runtime's file: %v", runtime)
|
t.Fatalf("live-restore is not written into the runtime's file: %v", runtime)
|
||||||
}
|
}
|
||||||
@@ -195,7 +203,7 @@ func TestTheResolverAndWhatAsksItComposeOnOneMachine(t *testing.T) {
|
|||||||
t.Errorf("the runtime is ordered restarted, which stops every container (ADR 0102): %v", r)
|
t.Errorf("the runtime is ordered restarted, which stops every container (ADR 0102): %v", r)
|
||||||
}
|
}
|
||||||
for _, on := range asStrings(r["reload-on"]) {
|
for _, on := range asStrings(r["reload-on"]) {
|
||||||
if on == "resolv-conf.runtime-config" {
|
if on == "docker.daemon" {
|
||||||
reloaded = true
|
reloaded = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user