Browse code

add integration test for FQDN hostname

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2016/12/13 02:19:23
Showing 1 changed files
... ...
@@ -4482,6 +4482,20 @@ func (s *DockerSuite) TestRunMountReadOnlyDevShm(c *check.C) {
4482 4482
 	c.Assert(out, checker.Contains, "Read-only file system")
4483 4483
 }
4484 4484
 
4485
+// Test that passing a FQDN as hostname properly sets hostname, and
4486
+// /etc/hostname. Test case for 29100
4487
+func (s *DockerSuite) TestRunHostnameFQDN(c *check.C) {
4488
+	testRequires(c, DaemonIsLinux)
4489
+
4490
+	expectedOutput := "foobar.example.com\nfoobar.example.com\nfoobar\nexample.com\nfoobar.example.com"
4491
+	out, _ := dockerCmd(c, "run", "--hostname=foobar.example.com", "busybox", "sh", "-c", `cat /etc/hostname && hostname && hostname -s && hostname -d && hostname -f`)
4492
+	c.Assert(strings.TrimSpace(out), checker.Equals, expectedOutput)
4493
+
4494
+	out, _ = dockerCmd(c, "run", "--hostname=foobar.example.com", "busybox", "sh", "-c", `cat /etc/hosts`)
4495
+	expectedOutput = "foobar.example.com foobar"
4496
+	c.Assert(strings.TrimSpace(out), checker.Contains, expectedOutput)
4497
+}
4498
+
4485 4499
 // Test case for 29129
4486 4500
 func (s *DockerSuite) TestRunHostnameInHostMode(c *check.C) {
4487 4501
 	testRequires(c, DaemonIsLinux, NotUserNamespace)