images: tests: Fix typos in the tests
This is a non-functional change, that fixes the following typos: * Snashotter -> Snapshotter * expectSnapshotter -> expectedSnapshotter * expectErr -> expectedErr * exiting-runtime -> existing-runtime Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
parent
17294e5816
commit
9ee3bfaba2
@ -378,29 +378,29 @@ func TestDefaultScheme(t *testing.T) {
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
func TestSnapshotterFromPodSandboxConfig(t *testing.T) {
|
func TestSnapshotterFromPodSandboxConfig(t *testing.T) {
|
||||||
defaultSnashotter := "native"
|
defaultSnapshotter := "native"
|
||||||
runtimeSnapshotter := "devmapper"
|
runtimeSnapshotter := "devmapper"
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
desc string
|
desc string
|
||||||
podSandboxConfig *runtime.PodSandboxConfig
|
podSandboxConfig *runtime.PodSandboxConfig
|
||||||
expectSnapshotter string
|
expectedSnapshotter string
|
||||||
expectErr bool
|
expectedErr bool
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
desc: "should return default snapshotter for nil podSandboxConfig",
|
desc: "should return default snapshotter for nil podSandboxConfig",
|
||||||
expectSnapshotter: defaultSnashotter,
|
expectedSnapshotter: defaultSnapshotter,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "should return default snapshotter for nil podSandboxConfig.Annotations",
|
desc: "should return default snapshotter for nil podSandboxConfig.Annotations",
|
||||||
podSandboxConfig: &runtime.PodSandboxConfig{},
|
podSandboxConfig: &runtime.PodSandboxConfig{},
|
||||||
expectSnapshotter: defaultSnashotter,
|
expectedSnapshotter: defaultSnapshotter,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "should return default snapshotter for empty podSandboxConfig.Annotations",
|
desc: "should return default snapshotter for empty podSandboxConfig.Annotations",
|
||||||
podSandboxConfig: &runtime.PodSandboxConfig{
|
podSandboxConfig: &runtime.PodSandboxConfig{
|
||||||
Annotations: make(map[string]string),
|
Annotations: make(map[string]string),
|
||||||
},
|
},
|
||||||
expectSnapshotter: defaultSnashotter,
|
expectedSnapshotter: defaultSnapshotter,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "should return default snapshotter for runtime not found",
|
desc: "should return default snapshotter for runtime not found",
|
||||||
@ -409,30 +409,30 @@ func TestSnapshotterFromPodSandboxConfig(t *testing.T) {
|
|||||||
annotations.RuntimeHandler: "runtime-not-exists",
|
annotations.RuntimeHandler: "runtime-not-exists",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expectSnapshotter: defaultSnashotter,
|
expectedSnapshotter: defaultSnapshotter,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "should return snapshotter provided in podSandboxConfig.Annotations",
|
desc: "should return snapshotter provided in podSandboxConfig.Annotations",
|
||||||
podSandboxConfig: &runtime.PodSandboxConfig{
|
podSandboxConfig: &runtime.PodSandboxConfig{
|
||||||
Annotations: map[string]string{
|
Annotations: map[string]string{
|
||||||
annotations.RuntimeHandler: "exiting-runtime",
|
annotations.RuntimeHandler: "existing-runtime",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expectSnapshotter: runtimeSnapshotter,
|
expectedSnapshotter: runtimeSnapshotter,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.desc, func(t *testing.T) {
|
t.Run(tt.desc, func(t *testing.T) {
|
||||||
cri, _ := newTestCRIService()
|
cri, _ := newTestCRIService()
|
||||||
cri.config.Snapshotter = defaultSnashotter
|
cri.config.Snapshotter = defaultSnapshotter
|
||||||
cri.runtimePlatforms["exiting-runtime"] = ImagePlatform{
|
cri.runtimePlatforms["existing-runtime"] = ImagePlatform{
|
||||||
Platform: platforms.DefaultSpec(),
|
Platform: platforms.DefaultSpec(),
|
||||||
Snapshotter: runtimeSnapshotter,
|
Snapshotter: runtimeSnapshotter,
|
||||||
}
|
}
|
||||||
snapshotter, err := cri.snapshotterFromPodSandboxConfig(context.Background(), "test-image", tt.podSandboxConfig)
|
snapshotter, err := cri.snapshotterFromPodSandboxConfig(context.Background(), "test-image", tt.podSandboxConfig)
|
||||||
assert.Equal(t, tt.expectSnapshotter, snapshotter)
|
assert.Equal(t, tt.expectedSnapshotter, snapshotter)
|
||||||
if tt.expectErr {
|
if tt.expectedErr {
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user