mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 05:03:09 +00:00
TestCreatePodSandbox_RuntimeClass should not expect RunPodSandbox when runtime class is not found
This commit is contained in:
parent
adc95eb214
commit
6b51d48c4f
@ -23,7 +23,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
utilfeaturetesting "k8s.io/apiserver/pkg/util/feature/testing"
|
utilfeaturetesting "k8s.io/apiserver/pkg/util/feature/testing"
|
||||||
@ -79,13 +79,13 @@ func TestCreatePodSandbox_RuntimeClass(t *testing.T) {
|
|||||||
}
|
}
|
||||||
for name, test := range tests {
|
for name, test := range tests {
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
|
fakeRuntime.Called = []string{}
|
||||||
pod := newTestPod()
|
pod := newTestPod()
|
||||||
pod.Spec.RuntimeClassName = test.rcn
|
pod.Spec.RuntimeClassName = test.rcn
|
||||||
|
|
||||||
id, _, err := m.createPodSandbox(pod, 1)
|
id, _, err := m.createPodSandbox(pod, 1)
|
||||||
if test.expectError {
|
if test.expectError {
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
assert.Contains(t, fakeRuntime.Called, "RunPodSandbox")
|
|
||||||
} else {
|
} else {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Contains(t, fakeRuntime.Called, "RunPodSandbox")
|
assert.Contains(t, fakeRuntime.Called, "RunPodSandbox")
|
||||||
|
Loading…
Reference in New Issue
Block a user