Fix a bad assumption

If the empty variable happens to be sorted to the end of the list then TrimSpace()
would remove it. Instead only strip the single trailing newline.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
(cherry picked from commit fff605c3b3557acf6bf793813d695fba59d7fa21)
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com>
This commit is contained in:
Daniel Nephin
2017-09-06 17:32:56 -04:00
committed by Eli Uriegas
parent ae21824df8
commit dff328c8a6

View File

@ -824,7 +824,7 @@ func (s *DockerSuite) TestRunEnvironment(c *check.C) {
})
result.Assert(c, icmd.Success)
actualEnv := strings.Split(strings.TrimSpace(result.Combined()), "\n")
actualEnv := strings.Split(strings.TrimSuffix(result.Stdout(), "\n"), "\n")
sort.Strings(actualEnv)
goodEnv := []string{