Compare to the correct host network setting
In systemd-resolved hosts with no DNS customizations, the docker driver DNS setting should be compared to /run/systemd/resolve/resolv.conf while exec/java drivers should be compared to /etc/resolv.conf. When system-resolved is enabled, /etc/resolv.conf is a stub that points to 127.0.0.53. Docker avoids this stub because this address isn't accessible from the container. The exec/java drivers that don't create network isolations use the stub though in the default configuration.
This commit is contained in:
parent
f4b0aa0c1c
commit
567597e108
|
@ -16,7 +16,11 @@ func TestTaskDNSConfig(t *testing.T, driver *DriverHarness, taskID string, dns *
|
||||||
caps, err := driver.Capabilities()
|
caps, err := driver.Capabilities()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
isolated := (caps.FSIsolation != drivers.FSIsolationNone)
|
// FS isolation is used here as a proxy for network isolation.
|
||||||
|
// This is true for the current built-in drivers but it is not necessarily so.
|
||||||
|
isolated := caps.FSIsolation != drivers.FSIsolationNone
|
||||||
|
usesHostNetwork := caps.FSIsolation != drivers.FSIsolationImage
|
||||||
|
|
||||||
if !isolated {
|
if !isolated {
|
||||||
t.Skip("dns config not supported on non isolated drivers")
|
t.Skip("dns config not supported on non isolated drivers")
|
||||||
}
|
}
|
||||||
|
@ -39,7 +43,12 @@ func TestTaskDNSConfig(t *testing.T, driver *DriverHarness, taskID string, dns *
|
||||||
require.ElementsMatch(t, dns.Options, dresolvconf.GetOptions(resolvConf))
|
require.ElementsMatch(t, dns.Options, dresolvconf.GetOptions(resolvConf))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
system, err := dresolvconf.Get()
|
systemPath := "/etc/resolv.conf"
|
||||||
|
if !usesHostNetwork {
|
||||||
|
systemPath = dresolvconf.Path()
|
||||||
|
}
|
||||||
|
|
||||||
|
system, err := dresolvconf.GetSpecific(systemPath)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.ElementsMatch(t, dresolvconf.GetNameservers(system.Content, dtypes.IP), dresolvconf.GetNameservers(resolvConf, dtypes.IP))
|
require.ElementsMatch(t, dresolvconf.GetNameservers(system.Content, dtypes.IP), dresolvconf.GetNameservers(resolvConf, dtypes.IP))
|
||||||
require.ElementsMatch(t, dresolvconf.GetSearchDomains(system.Content), dresolvconf.GetSearchDomains(resolvConf))
|
require.ElementsMatch(t, dresolvconf.GetSearchDomains(system.Content), dresolvconf.GetSearchDomains(resolvConf))
|
||||||
|
|
Loading…
Reference in a new issue