From 337ae801ffdbe6642135c0775bd400e157c47861 Mon Sep 17 00:00:00 2001 From: Zygmunt Krynicki Date: Fri, 8 Sep 2017 10:52:58 +0200 Subject: [PATCH] osutil: adjust StreamCommand tests for golang 1.9 In golang 1.9 there are richer error constructs returned from certain operations and tests were very precisely monitoring the result. This patch adjust tests to work on both golang 1.9 and earlier. Signed-off-by: Zygmunt Krynicki Gbp-Pq: Name 0001-osutil-adjust-StreamCommand-tests-for-golang-1.9.patch --- osutil/exec_test.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/osutil/exec_test.go b/osutil/exec_test.go index c6ba4654..6818a3ac 100644 --- a/osutil/exec_test.go +++ b/osutil/exec_test.go @@ -207,8 +207,9 @@ func (s *execSuite) TestStreamCommandHappy(c *C) { wrf, wrc := osutil.WaitingReaderGuts(stdout) c.Assert(wrf, FitsTypeOf, &os.File{}) - c.Check(wrf.(*os.File).Close(), Equals, syscall.EINVAL) // i.e. already closed - c.Check(wrc.ProcessState, NotNil) // i.e. already waited for + // Depending on golang version the error is one of the two. + c.Check(wrf.(*os.File).Close(), ErrorMatches, "invalid argument|file already closed") + c.Check(wrc.ProcessState, NotNil) // i.e. already waited for } func (s *execSuite) TestStreamCommandSad(c *C) { @@ -221,6 +222,7 @@ func (s *execSuite) TestStreamCommandSad(c *C) { wrf, wrc := osutil.WaitingReaderGuts(stdout) c.Assert(wrf, FitsTypeOf, &os.File{}) - c.Check(wrf.(*os.File).Close(), Equals, syscall.EINVAL) // i.e. already closed - c.Check(wrc.ProcessState, NotNil) // i.e. already waited for + // Depending on golang version the error is one of the two. + c.Check(wrf.(*os.File).Close(), ErrorMatches, "invalid argument|file already closed") + c.Check(wrc.ProcessState, NotNil) // i.e. already waited for } -- 2.30.2