Skip to content

Commit

Permalink
images: tests: Fix typos in the tests
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
fidencio committed Apr 22, 2024
1 parent 17294e5 commit 5d5e36b
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions internal/cri/server/images/image_pull_test.go
Expand Up @@ -378,29 +378,29 @@ func TestDefaultScheme(t *testing.T) {
//}

func TestSnapshotterFromPodSandboxConfig(t *testing.T) {
defaultSnashotter := "native"
defaultSnapshotter := "native"
runtimeSnapshotter := "devmapper"
tests := []struct {
desc string
podSandboxConfig *runtime.PodSandboxConfig
expectSnapshotter string
expectErr bool
desc string
podSandboxConfig *runtime.PodSandboxConfig
expectedSnapshotter string
expectedErr bool
}{
{
desc: "should return default snapshotter for nil podSandboxConfig",

Check failure on line 390 in internal/cri/server/images/image_pull_test.go

View workflow job for this annotation

GitHub Actions / Linters (ubuntu-22.04)

File is not `gofmt`-ed with `-s` (gofmt)
expectSnapshotter: defaultSnashotter,
expectedSnapshotter: defaultSnapshotter,
},
{
desc: "should return default snapshotter for nil podSandboxConfig.Annotations",

Check failure on line 394 in internal/cri/server/images/image_pull_test.go

View workflow job for this annotation

GitHub Actions / Linters (ubuntu-22.04)

File is not `goimports`-ed (goimports)
podSandboxConfig: &runtime.PodSandboxConfig{},
expectSnapshotter: defaultSnashotter,
expectedSnapshotter: defaultSnapshotter,
},
{
desc: "should return default snapshotter for empty podSandboxConfig.Annotations",
podSandboxConfig: &runtime.PodSandboxConfig{
Annotations: make(map[string]string),
},
expectSnapshotter: defaultSnashotter,
expectedSnapshotter: defaultSnapshotter,
},
{
desc: "should return default snapshotter for runtime not found",
Expand All @@ -409,30 +409,30 @@ func TestSnapshotterFromPodSandboxConfig(t *testing.T) {
annotations.RuntimeHandler: "runtime-not-exists",
},
},
expectSnapshotter: defaultSnashotter,
expectedSnapshotter: defaultSnapshotter,
},
{
desc: "should return snapshotter provided in podSandboxConfig.Annotations",
podSandboxConfig: &runtime.PodSandboxConfig{
Annotations: map[string]string{
annotations.RuntimeHandler: "exiting-runtime",
annotations.RuntimeHandler: "existing-runtime",
},
},
expectSnapshotter: runtimeSnapshotter,
expectedSnapshotter: runtimeSnapshotter,
},
}

for _, tt := range tests {
t.Run(tt.desc, func(t *testing.T) {
cri, _ := newTestCRIService()
cri.config.Snapshotter = defaultSnashotter
cri.runtimePlatforms["exiting-runtime"] = ImagePlatform{
cri.config.Snapshotter = defaultSnapshotter
cri.runtimePlatforms["existing-runtime"] = ImagePlatform{
Platform: platforms.DefaultSpec(),
Snapshotter: runtimeSnapshotter,
}
snapshotter, err := cri.snapshotterFromPodSandboxConfig(context.Background(), "test-image", tt.podSandboxConfig)
assert.Equal(t, tt.expectSnapshotter, snapshotter)
if tt.expectErr {
assert.Equal(t, tt.expectedSnapshotter, snapshotter)
if tt.expectedErr {
assert.Error(t, err)
}
})
Expand Down

0 comments on commit 5d5e36b

Please sign in to comment.