mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 15:37:24 +00:00
Add return code support to kubectl-exec and -run
This commit is contained in:
committed by
Dr. Stefan Schimanski
parent
6dcb0c9130
commit
e792d4117d
@@ -34,6 +34,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
"k8s.io/kubernetes/pkg/apis/extensions"
|
||||
"k8s.io/kubernetes/pkg/runtime"
|
||||
uexec "k8s.io/kubernetes/pkg/util/exec"
|
||||
"k8s.io/kubernetes/pkg/util/validation/field"
|
||||
)
|
||||
|
||||
@@ -269,6 +270,16 @@ func TestCheckNoResourceMatchError(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestCheckExitError(t *testing.T) {
|
||||
testCheckError(t, []checkErrTestCase{
|
||||
{
|
||||
uexec.CodeExitError{Err: fmt.Errorf("pod foo/bar terminated"), Code: 42},
|
||||
"",
|
||||
42,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testCheckError(t *testing.T, tests []checkErrTestCase) {
|
||||
var errReturned string
|
||||
var codeReturned int
|
||||
|
||||
Reference in New Issue
Block a user