func benchListImages(b *testing.B, c v1alpha.PublicAPIClient, detail bool) { b.ResetTimer() for i := 0; i < b.N; i++ { _, err := c.ListImages(context.Background(), &v1alpha.ListImagesRequest{Detail: detail}) if err != nil { b.Error(err) } } b.StopTimer() }
func benchInspectImage(b *testing.B, c v1alpha.PublicAPIClient) { resp, err := c.ListImages(context.Background(), &v1alpha.ListImagesRequest{}) if err != nil { b.Fatalf("Unexpected error: %v", err) } b.ResetTimer() for i := 0; i < b.N; i++ { _, err := c.InspectImage(context.Background(), &v1alpha.InspectImageRequest{Id: resp.Images[0].Id}) if err != nil { b.Error(err) } } b.StopTimer() }