docker_cli_cp_test.go 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. package main
  2. import (
  3. "bytes"
  4. "fmt"
  5. "io/ioutil"
  6. "os"
  7. "os/exec"
  8. "path"
  9. "path/filepath"
  10. "strings"
  11. "github.com/go-check/check"
  12. )
  13. const (
  14. cpTestPathParent = "/some"
  15. cpTestPath = "/some/path"
  16. cpTestName = "test"
  17. cpFullPath = "/some/path/test"
  18. cpContainerContents = "holla, i am the container"
  19. cpHostContents = "hello, i am the host"
  20. )
  21. // Test for #5656
  22. // Check that garbage paths don't escape the container's rootfs
  23. func (s *DockerSuite) TestCpGarbagePath(c *check.C) {
  24. out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath)
  25. if exitCode != 0 {
  26. c.Fatal("failed to create a container", out)
  27. }
  28. cleanedContainerID := strings.TrimSpace(out)
  29. out, _ = dockerCmd(c, "wait", cleanedContainerID)
  30. if strings.TrimSpace(out) != "0" {
  31. c.Fatal("failed to set up container", out)
  32. }
  33. if err := os.MkdirAll(cpTestPath, os.ModeDir); err != nil {
  34. c.Fatal(err)
  35. }
  36. hostFile, err := os.Create(cpFullPath)
  37. if err != nil {
  38. c.Fatal(err)
  39. }
  40. defer hostFile.Close()
  41. defer os.RemoveAll(cpTestPathParent)
  42. fmt.Fprintf(hostFile, "%s", cpHostContents)
  43. tmpdir, err := ioutil.TempDir("", "docker-integration")
  44. if err != nil {
  45. c.Fatal(err)
  46. }
  47. tmpname := filepath.Join(tmpdir, cpTestName)
  48. defer os.RemoveAll(tmpdir)
  49. path := path.Join("../../../../../../../../../../../../", cpFullPath)
  50. _, _ = dockerCmd(c, "cp", cleanedContainerID+":"+path, tmpdir)
  51. file, _ := os.Open(tmpname)
  52. defer file.Close()
  53. test, err := ioutil.ReadAll(file)
  54. if err != nil {
  55. c.Fatal(err)
  56. }
  57. if string(test) == cpHostContents {
  58. c.Errorf("output matched host file -- garbage path can escape container rootfs")
  59. }
  60. if string(test) != cpContainerContents {
  61. c.Errorf("output doesn't match the input for garbage path")
  62. }
  63. }
  64. // Check that relative paths are relative to the container's rootfs
  65. func (s *DockerSuite) TestCpRelativePath(c *check.C) {
  66. out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath)
  67. if exitCode != 0 {
  68. c.Fatal("failed to create a container", out)
  69. }
  70. cleanedContainerID := strings.TrimSpace(out)
  71. out, _ = dockerCmd(c, "wait", cleanedContainerID)
  72. if strings.TrimSpace(out) != "0" {
  73. c.Fatal("failed to set up container", out)
  74. }
  75. if err := os.MkdirAll(cpTestPath, os.ModeDir); err != nil {
  76. c.Fatal(err)
  77. }
  78. hostFile, err := os.Create(cpFullPath)
  79. if err != nil {
  80. c.Fatal(err)
  81. }
  82. defer hostFile.Close()
  83. defer os.RemoveAll(cpTestPathParent)
  84. fmt.Fprintf(hostFile, "%s", cpHostContents)
  85. tmpdir, err := ioutil.TempDir("", "docker-integration")
  86. if err != nil {
  87. c.Fatal(err)
  88. }
  89. tmpname := filepath.Join(tmpdir, cpTestName)
  90. defer os.RemoveAll(tmpdir)
  91. var relPath string
  92. if path.IsAbs(cpFullPath) {
  93. // normally this is `filepath.Rel("/", cpFullPath)` but we cannot
  94. // get this unix-path manipulation on windows with filepath.
  95. relPath = cpFullPath[1:]
  96. } else {
  97. c.Fatalf("path %s was assumed to be an absolute path", cpFullPath)
  98. }
  99. _, _ = dockerCmd(c, "cp", cleanedContainerID+":"+relPath, tmpdir)
  100. file, _ := os.Open(tmpname)
  101. defer file.Close()
  102. test, err := ioutil.ReadAll(file)
  103. if err != nil {
  104. c.Fatal(err)
  105. }
  106. if string(test) == cpHostContents {
  107. c.Errorf("output matched host file -- relative path can escape container rootfs")
  108. }
  109. if string(test) != cpContainerContents {
  110. c.Errorf("output doesn't match the input for relative path")
  111. }
  112. }
  113. // Check that absolute paths are relative to the container's rootfs
  114. func (s *DockerSuite) TestCpAbsolutePath(c *check.C) {
  115. out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath)
  116. if exitCode != 0 {
  117. c.Fatal("failed to create a container", out)
  118. }
  119. cleanedContainerID := strings.TrimSpace(out)
  120. out, _ = dockerCmd(c, "wait", cleanedContainerID)
  121. if strings.TrimSpace(out) != "0" {
  122. c.Fatal("failed to set up container", out)
  123. }
  124. if err := os.MkdirAll(cpTestPath, os.ModeDir); err != nil {
  125. c.Fatal(err)
  126. }
  127. hostFile, err := os.Create(cpFullPath)
  128. if err != nil {
  129. c.Fatal(err)
  130. }
  131. defer hostFile.Close()
  132. defer os.RemoveAll(cpTestPathParent)
  133. fmt.Fprintf(hostFile, "%s", cpHostContents)
  134. tmpdir, err := ioutil.TempDir("", "docker-integration")
  135. if err != nil {
  136. c.Fatal(err)
  137. }
  138. tmpname := filepath.Join(tmpdir, cpTestName)
  139. defer os.RemoveAll(tmpdir)
  140. path := cpFullPath
  141. _, _ = dockerCmd(c, "cp", cleanedContainerID+":"+path, tmpdir)
  142. file, _ := os.Open(tmpname)
  143. defer file.Close()
  144. test, err := ioutil.ReadAll(file)
  145. if err != nil {
  146. c.Fatal(err)
  147. }
  148. if string(test) == cpHostContents {
  149. c.Errorf("output matched host file -- absolute path can escape container rootfs")
  150. }
  151. if string(test) != cpContainerContents {
  152. c.Errorf("output doesn't match the input for absolute path")
  153. }
  154. }
  155. // Test for #5619
  156. // Check that absolute symlinks are still relative to the container's rootfs
  157. func (s *DockerSuite) TestCpAbsoluteSymlink(c *check.C) {
  158. out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath+" && ln -s "+cpFullPath+" container_path")
  159. if exitCode != 0 {
  160. c.Fatal("failed to create a container", out)
  161. }
  162. cleanedContainerID := strings.TrimSpace(out)
  163. out, _ = dockerCmd(c, "wait", cleanedContainerID)
  164. if strings.TrimSpace(out) != "0" {
  165. c.Fatal("failed to set up container", out)
  166. }
  167. if err := os.MkdirAll(cpTestPath, os.ModeDir); err != nil {
  168. c.Fatal(err)
  169. }
  170. hostFile, err := os.Create(cpFullPath)
  171. if err != nil {
  172. c.Fatal(err)
  173. }
  174. defer hostFile.Close()
  175. defer os.RemoveAll(cpTestPathParent)
  176. fmt.Fprintf(hostFile, "%s", cpHostContents)
  177. tmpdir, err := ioutil.TempDir("", "docker-integration")
  178. if err != nil {
  179. c.Fatal(err)
  180. }
  181. tmpname := filepath.Join(tmpdir, cpTestName)
  182. defer os.RemoveAll(tmpdir)
  183. path := path.Join("/", "container_path")
  184. _, _ = dockerCmd(c, "cp", cleanedContainerID+":"+path, tmpdir)
  185. file, _ := os.Open(tmpname)
  186. defer file.Close()
  187. test, err := ioutil.ReadAll(file)
  188. if err != nil {
  189. c.Fatal(err)
  190. }
  191. if string(test) == cpHostContents {
  192. c.Errorf("output matched host file -- absolute symlink can escape container rootfs")
  193. }
  194. if string(test) != cpContainerContents {
  195. c.Errorf("output doesn't match the input for absolute symlink")
  196. }
  197. }
  198. // Test for #5619
  199. // Check that symlinks which are part of the resource path are still relative to the container's rootfs
  200. func (s *DockerSuite) TestCpSymlinkComponent(c *check.C) {
  201. out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "mkdir -p '"+cpTestPath+"' && echo -n '"+cpContainerContents+"' > "+cpFullPath+" && ln -s "+cpTestPath+" container_path")
  202. if exitCode != 0 {
  203. c.Fatal("failed to create a container", out)
  204. }
  205. cleanedContainerID := strings.TrimSpace(out)
  206. out, _ = dockerCmd(c, "wait", cleanedContainerID)
  207. if strings.TrimSpace(out) != "0" {
  208. c.Fatal("failed to set up container", out)
  209. }
  210. if err := os.MkdirAll(cpTestPath, os.ModeDir); err != nil {
  211. c.Fatal(err)
  212. }
  213. hostFile, err := os.Create(cpFullPath)
  214. if err != nil {
  215. c.Fatal(err)
  216. }
  217. defer hostFile.Close()
  218. defer os.RemoveAll(cpTestPathParent)
  219. fmt.Fprintf(hostFile, "%s", cpHostContents)
  220. tmpdir, err := ioutil.TempDir("", "docker-integration")
  221. if err != nil {
  222. c.Fatal(err)
  223. }
  224. tmpname := filepath.Join(tmpdir, cpTestName)
  225. defer os.RemoveAll(tmpdir)
  226. path := path.Join("/", "container_path", cpTestName)
  227. _, _ = dockerCmd(c, "cp", cleanedContainerID+":"+path, tmpdir)
  228. file, _ := os.Open(tmpname)
  229. defer file.Close()
  230. test, err := ioutil.ReadAll(file)
  231. if err != nil {
  232. c.Fatal(err)
  233. }
  234. if string(test) == cpHostContents {
  235. c.Errorf("output matched host file -- symlink path component can escape container rootfs")
  236. }
  237. if string(test) != cpContainerContents {
  238. c.Errorf("output doesn't match the input for symlink path component")
  239. }
  240. }
  241. // Check that cp with unprivileged user doesn't return any error
  242. func (s *DockerSuite) TestCpUnprivilegedUser(c *check.C) {
  243. testRequires(c, UnixCli) // uses chmod/su: not available on windows
  244. out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "touch "+cpTestName)
  245. if exitCode != 0 {
  246. c.Fatal("failed to create a container", out)
  247. }
  248. cleanedContainerID := strings.TrimSpace(out)
  249. out, _ = dockerCmd(c, "wait", cleanedContainerID)
  250. if strings.TrimSpace(out) != "0" {
  251. c.Fatal("failed to set up container", out)
  252. }
  253. tmpdir, err := ioutil.TempDir("", "docker-integration")
  254. if err != nil {
  255. c.Fatal(err)
  256. }
  257. defer os.RemoveAll(tmpdir)
  258. if err = os.Chmod(tmpdir, 0777); err != nil {
  259. c.Fatal(err)
  260. }
  261. path := cpTestName
  262. _, _, err = runCommandWithOutput(exec.Command("su", "unprivilegeduser", "-c", dockerBinary+" cp "+cleanedContainerID+":"+path+" "+tmpdir))
  263. if err != nil {
  264. c.Fatalf("couldn't copy with unprivileged user: %s:%s %s", cleanedContainerID, path, err)
  265. }
  266. }
  267. func (s *DockerSuite) TestCpSpecialFiles(c *check.C) {
  268. testRequires(c, SameHostDaemon)
  269. outDir, err := ioutil.TempDir("", "cp-test-special-files")
  270. if err != nil {
  271. c.Fatal(err)
  272. }
  273. defer os.RemoveAll(outDir)
  274. out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "touch /foo")
  275. if exitCode != 0 {
  276. c.Fatal("failed to create a container", out)
  277. }
  278. cleanedContainerID := strings.TrimSpace(out)
  279. out, _ = dockerCmd(c, "wait", cleanedContainerID)
  280. if strings.TrimSpace(out) != "0" {
  281. c.Fatal("failed to set up container", out)
  282. }
  283. // Copy actual /etc/resolv.conf
  284. _, _ = dockerCmd(c, "cp", cleanedContainerID+":/etc/resolv.conf", outDir)
  285. expected, err := ioutil.ReadFile("/var/lib/docker/containers/" + cleanedContainerID + "/resolv.conf")
  286. actual, err := ioutil.ReadFile(outDir + "/resolv.conf")
  287. if !bytes.Equal(actual, expected) {
  288. c.Fatalf("Expected copied file to be duplicate of the container resolvconf")
  289. }
  290. // Copy actual /etc/hosts
  291. _, _ = dockerCmd(c, "cp", cleanedContainerID+":/etc/hosts", outDir)
  292. expected, err = ioutil.ReadFile("/var/lib/docker/containers/" + cleanedContainerID + "/hosts")
  293. actual, err = ioutil.ReadFile(outDir + "/hosts")
  294. if !bytes.Equal(actual, expected) {
  295. c.Fatalf("Expected copied file to be duplicate of the container hosts")
  296. }
  297. // Copy actual /etc/resolv.conf
  298. _, _ = dockerCmd(c, "cp", cleanedContainerID+":/etc/hostname", outDir)
  299. expected, err = ioutil.ReadFile("/var/lib/docker/containers/" + cleanedContainerID + "/hostname")
  300. actual, err = ioutil.ReadFile(outDir + "/hostname")
  301. if !bytes.Equal(actual, expected) {
  302. c.Fatalf("Expected copied file to be duplicate of the container resolvconf")
  303. }
  304. }
  305. func (s *DockerSuite) TestCpVolumePath(c *check.C) {
  306. testRequires(c, SameHostDaemon)
  307. tmpDir, err := ioutil.TempDir("", "cp-test-volumepath")
  308. if err != nil {
  309. c.Fatal(err)
  310. }
  311. defer os.RemoveAll(tmpDir)
  312. outDir, err := ioutil.TempDir("", "cp-test-volumepath-out")
  313. if err != nil {
  314. c.Fatal(err)
  315. }
  316. defer os.RemoveAll(outDir)
  317. _, err = os.Create(tmpDir + "/test")
  318. if err != nil {
  319. c.Fatal(err)
  320. }
  321. out, exitCode := dockerCmd(c, "run", "-d", "-v", "/foo", "-v", tmpDir+"/test:/test", "-v", tmpDir+":/baz", "busybox", "/bin/sh", "-c", "touch /foo/bar")
  322. if exitCode != 0 {
  323. c.Fatal("failed to create a container", out)
  324. }
  325. cleanedContainerID := strings.TrimSpace(out)
  326. out, _ = dockerCmd(c, "wait", cleanedContainerID)
  327. if strings.TrimSpace(out) != "0" {
  328. c.Fatal("failed to set up container", out)
  329. }
  330. // Copy actual volume path
  331. _, _ = dockerCmd(c, "cp", cleanedContainerID+":/foo", outDir)
  332. stat, err := os.Stat(outDir + "/foo")
  333. if err != nil {
  334. c.Fatal(err)
  335. }
  336. if !stat.IsDir() {
  337. c.Fatal("expected copied content to be dir")
  338. }
  339. stat, err = os.Stat(outDir + "/foo/bar")
  340. if err != nil {
  341. c.Fatal(err)
  342. }
  343. if stat.IsDir() {
  344. c.Fatal("Expected file `bar` to be a file")
  345. }
  346. // Copy file nested in volume
  347. _, _ = dockerCmd(c, "cp", cleanedContainerID+":/foo/bar", outDir)
  348. stat, err = os.Stat(outDir + "/bar")
  349. if err != nil {
  350. c.Fatal(err)
  351. }
  352. if stat.IsDir() {
  353. c.Fatal("Expected file `bar` to be a file")
  354. }
  355. // Copy Bind-mounted dir
  356. _, _ = dockerCmd(c, "cp", cleanedContainerID+":/baz", outDir)
  357. stat, err = os.Stat(outDir + "/baz")
  358. if err != nil {
  359. c.Fatal(err)
  360. }
  361. if !stat.IsDir() {
  362. c.Fatal("Expected `baz` to be a dir")
  363. }
  364. // Copy file nested in bind-mounted dir
  365. _, _ = dockerCmd(c, "cp", cleanedContainerID+":/baz/test", outDir)
  366. fb, err := ioutil.ReadFile(outDir + "/baz/test")
  367. if err != nil {
  368. c.Fatal(err)
  369. }
  370. fb2, err := ioutil.ReadFile(tmpDir + "/test")
  371. if err != nil {
  372. c.Fatal(err)
  373. }
  374. if !bytes.Equal(fb, fb2) {
  375. c.Fatalf("Expected copied file to be duplicate of bind-mounted file")
  376. }
  377. // Copy bind-mounted file
  378. _, _ = dockerCmd(c, "cp", cleanedContainerID+":/test", outDir)
  379. fb, err = ioutil.ReadFile(outDir + "/test")
  380. if err != nil {
  381. c.Fatal(err)
  382. }
  383. fb2, err = ioutil.ReadFile(tmpDir + "/test")
  384. if err != nil {
  385. c.Fatal(err)
  386. }
  387. if !bytes.Equal(fb, fb2) {
  388. c.Fatalf("Expected copied file to be duplicate of bind-mounted file")
  389. }
  390. }
  391. func (s *DockerSuite) TestCpToDot(c *check.C) {
  392. out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "echo lololol > /test")
  393. if exitCode != 0 {
  394. c.Fatal("failed to create a container", out)
  395. }
  396. cleanedContainerID := strings.TrimSpace(out)
  397. out, _ = dockerCmd(c, "wait", cleanedContainerID)
  398. if strings.TrimSpace(out) != "0" {
  399. c.Fatal("failed to set up container", out)
  400. }
  401. tmpdir, err := ioutil.TempDir("", "docker-integration")
  402. if err != nil {
  403. c.Fatal(err)
  404. }
  405. defer os.RemoveAll(tmpdir)
  406. cwd, err := os.Getwd()
  407. if err != nil {
  408. c.Fatal(err)
  409. }
  410. defer os.Chdir(cwd)
  411. if err := os.Chdir(tmpdir); err != nil {
  412. c.Fatal(err)
  413. }
  414. _, _ = dockerCmd(c, "cp", cleanedContainerID+":/test", ".")
  415. content, err := ioutil.ReadFile("./test")
  416. if string(content) != "lololol\n" {
  417. c.Fatalf("Wrong content in copied file %q, should be %q", content, "lololol\n")
  418. }
  419. }
  420. func (s *DockerSuite) TestCpToStdout(c *check.C) {
  421. out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "echo lololol > /test")
  422. if exitCode != 0 {
  423. c.Fatalf("failed to create a container:%s\n", out)
  424. }
  425. cID := strings.TrimSpace(out)
  426. out, _ = dockerCmd(c, "wait", cID)
  427. if strings.TrimSpace(out) != "0" {
  428. c.Fatalf("failed to set up container:%s\n", out)
  429. }
  430. out, _, err := runCommandPipelineWithOutput(
  431. exec.Command(dockerBinary, "cp", cID+":/test", "-"),
  432. exec.Command("tar", "-vtf", "-"))
  433. if err != nil {
  434. c.Fatalf("Failed to run commands: %s", err)
  435. }
  436. if !strings.Contains(out, "test") || !strings.Contains(out, "-rw") {
  437. c.Fatalf("Missing file from tar TOC:\n%s", out)
  438. }
  439. }
  440. func (s *DockerSuite) TestCpNameHasColon(c *check.C) {
  441. testRequires(c, SameHostDaemon)
  442. out, exitCode := dockerCmd(c, "run", "-d", "busybox", "/bin/sh", "-c", "echo lololol > /te:s:t")
  443. if exitCode != 0 {
  444. c.Fatal("failed to create a container", out)
  445. }
  446. cleanedContainerID := strings.TrimSpace(out)
  447. out, _ = dockerCmd(c, "wait", cleanedContainerID)
  448. if strings.TrimSpace(out) != "0" {
  449. c.Fatal("failed to set up container", out)
  450. }
  451. tmpdir, err := ioutil.TempDir("", "docker-integration")
  452. if err != nil {
  453. c.Fatal(err)
  454. }
  455. defer os.RemoveAll(tmpdir)
  456. _, _ = dockerCmd(c, "cp", cleanedContainerID+":/te:s:t", tmpdir)
  457. content, err := ioutil.ReadFile(tmpdir + "/te:s:t")
  458. if string(content) != "lololol\n" {
  459. c.Fatalf("Wrong content in copied file %q, should be %q", content, "lololol\n")
  460. }
  461. }
  462. func (s *DockerSuite) TestCopyAndRestart(c *check.C) {
  463. expectedMsg := "hello"
  464. out, err := exec.Command(dockerBinary, "run", "-d", "busybox", "echo", expectedMsg).CombinedOutput()
  465. if err != nil {
  466. c.Fatal(string(out), err)
  467. }
  468. id := strings.TrimSpace(string(out))
  469. if out, err = exec.Command(dockerBinary, "wait", id).CombinedOutput(); err != nil {
  470. c.Fatalf("unable to wait for container: %s", err)
  471. }
  472. status := strings.TrimSpace(string(out))
  473. if status != "0" {
  474. c.Fatalf("container exited with status %s", status)
  475. }
  476. tmpDir, err := ioutil.TempDir("", "test-docker-restart-after-copy-")
  477. if err != nil {
  478. c.Fatalf("unable to make temporary directory: %s", err)
  479. }
  480. defer os.RemoveAll(tmpDir)
  481. if _, err = exec.Command(dockerBinary, "cp", fmt.Sprintf("%s:/etc/issue", id), tmpDir).CombinedOutput(); err != nil {
  482. c.Fatalf("unable to copy from busybox container: %s", err)
  483. }
  484. if out, err = exec.Command(dockerBinary, "start", "-a", id).CombinedOutput(); err != nil {
  485. c.Fatalf("unable to start busybox container after copy: %s - %s", err, out)
  486. }
  487. msg := strings.TrimSpace(string(out))
  488. if msg != expectedMsg {
  489. c.Fatalf("expected %q but got %q", expectedMsg, msg)
  490. }
  491. }