(f *testing.F)
| 34 | ) |
| 35 | |
| 36 | func FuzzCRIServer(f *testing.F) { |
| 37 | if os.Getuid() != 0 { |
| 38 | f.Skip("skipping fuzz test that requires root") |
| 39 | } |
| 40 | |
| 41 | f.Fuzz(func(t *testing.T, data []byte) { |
| 42 | initDaemon.Do(startDaemon) |
| 43 | |
| 44 | f := fuzz.NewConsumer(data) |
| 45 | |
| 46 | client, err := containerd.New(defaultAddress) |
| 47 | if err != nil { |
| 48 | t.Fatal(err) |
| 49 | } |
| 50 | defer client.Close() |
| 51 | |
| 52 | imageConfig := criconfig.ImageConfig{} |
| 53 | |
| 54 | imageService, err := images.NewService(imageConfig, &images.CRIImageServiceOptions{ |
| 55 | Client: client, |
| 56 | }) |
| 57 | if err != nil { |
| 58 | t.Fatal(err) |
| 59 | } |
| 60 | |
| 61 | c, rs, err := server.NewCRIService(&server.CRIServiceOptions{ |
| 62 | RuntimeService: &fakeRuntimeService{}, |
| 63 | ImageService: imageService, |
| 64 | Client: client, |
| 65 | }) |
| 66 | if err != nil { |
| 67 | t.Fatal(err) |
| 68 | } |
| 69 | |
| 70 | fuzzCRI(t, f, &service{ |
| 71 | CRIService: c, |
| 72 | RuntimeServiceServer: rs, |
| 73 | ImageServiceServer: imageService.GRPCService(), |
| 74 | }) |
| 75 | }) |
| 76 | } |
| 77 | |
| 78 | type fakeRuntimeService struct{} |
| 79 |
nothing calls this directly
no test coverage detected
searching dependent graphs…