MCPcopy
hub / github.com/containerd/containerd / FuzzCRIServer

Function FuzzCRIServer

contrib/fuzz/cri_server_fuzz_test.go:36–76  ·  view source on GitHub ↗
(f *testing.F)

Source from the content-addressed store, hash-verified

34)
35
36func 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
78type fakeRuntimeService struct{}
79

Callers

nothing calls this directly

Calls 7

NewServiceFunction · 0.92
NewCRIServiceFunction · 0.92
fuzzCRIFunction · 0.85
DoMethod · 0.80
FatalMethod · 0.80
CloseMethod · 0.65
GRPCServiceMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…