Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Nomad
Commits
ccbbea1e
Commit
ccbbea1e
authored
6 years ago
by
Mahmood Ali
Browse files
Options
Download
Email Patches
Plain Diff
handle stty format variance
parent
413753fc
Branches unavailable
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugins/drivers/testutils/exec_testing.go
+26
-5
plugins/drivers/testutils/exec_testing.go
with
26 additions
and
5 deletions
+26
-5
plugins/drivers/testutils/exec_testing.go
+
26
-
5
View file @
ccbbea1e
...
...
@@ -3,6 +3,8 @@ package testutils
import
(
"context"
"io"
"reflect"
"regexp"
"runtime"
"sync"
"testing"
...
...
@@ -29,8 +31,8 @@ var ExecTaskStreamingBasicCases = []struct {
Command
string
Tty
bool
Stdin
string
Stdout
string
Stderr
string
Stdout
interface
{}
Stderr
interface
{}
ExitCode
int
}{
{
...
...
@@ -52,7 +54,7 @@ var ExecTaskStreamingBasicCases = []struct {
Name
:
"ntty: stty check"
,
Command
:
"stty size"
,
Tty
:
false
,
Stderr
:
"stty: standard input: Inappropriate ioctl for device
\n
"
,
Stderr
:
regexp
.
MustCompile
(
"stty:
.?
standard input
.?
: Inappropriate ioctl for device
\n
"
)
,
ExitCode
:
1
,
},
{
...
...
@@ -156,8 +158,27 @@ func TestExecTaskStreamingBasicResponses(t *testing.T, driver *DriverHarness, ta
require
.
Equal
(
t
,
c
.
ExitCode
,
exitCode
)
}
require
.
Equal
(
t
,
c
.
Stdout
,
result
.
stdout
)
require
.
Equal
(
t
,
c
.
Stderr
,
result
.
stderr
)
switch
s
:=
c
.
Stdout
.
(
type
)
{
case
string
:
require
.
Equal
(
t
,
s
,
result
.
stdout
)
case
*
regexp
.
Regexp
:
require
.
Regexp
(
t
,
s
,
result
.
stdout
)
case
nil
:
require
.
Empty
(
t
,
result
.
stdout
)
default
:
require
.
Fail
(
t
,
"unexpected stdout type"
,
"found %v (%v), but expected string or regexp"
,
s
,
reflect
.
TypeOf
(
s
))
}
switch
s
:=
c
.
Stderr
.
(
type
)
{
case
string
:
require
.
Equal
(
t
,
s
,
result
.
stderr
)
case
*
regexp
.
Regexp
:
require
.
Regexp
(
t
,
s
,
result
.
stderr
)
case
nil
:
require
.
Empty
(
t
,
result
.
stderr
)
default
:
require
.
Fail
(
t
,
"unexpected stderr type"
,
"found %v (%v), but expected string or regexp"
,
s
,
reflect
.
TypeOf
(
s
))
}
})
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help