Skip to content

Commit 5362e8b

Browse files
Fix initialization bug in FakeImageService
When adding this functionality in kubernetes#88372, I forgot to allocate a map for the `Errors` field when constructing the object. As a result, trying to actually use the `InjectError` method failed (as I noticed when I started trying to write tests to actually use `InjectError`). Fortunately, `FakeImageService` is only used in tests... but still, we should fix this issue. Fixing in a separate diff from the one which will add additional test coverage (and actually use `InjectError`, because I don't like having non-working code in master.) We could also revert the original commit and then re-merge with this fix, but that seems like unnecessary work given we already have a fix ready to go.
1 parent 57025b6 commit 5362e8b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

staging/src/k8s.io/cri-api/pkg/apis/testing/fake_image_service.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ func (r *FakeImageService) SetFakeFilesystemUsage(usage []*runtimeapi.Filesystem
6565
func NewFakeImageService() *FakeImageService {
6666
return &FakeImageService{
6767
Called: make([]string, 0),
68+
Errors: make(map[string][]error),
6869
Images: make(map[string]*runtimeapi.Image),
6970
}
7071
}

0 commit comments

Comments
 (0)