コード例 #1
0
func benchListPods(b *testing.B, c v1alpha.PublicAPIClient, detail bool) {
	b.ResetTimer()
	for i := 0; i < b.N; i++ {
		_, err := c.ListPods(context.Background(), &v1alpha.ListPodsRequest{Detail: detail})
		if err != nil {
			b.Error(err)
		}
	}
	b.StopTimer()
}
コード例 #2
0
func benchInspectPod(b *testing.B, c v1alpha.PublicAPIClient) {
	resp, err := c.ListPods(context.Background(), &v1alpha.ListPodsRequest{})
	if err != nil {
		b.Fatalf("Unexpected error: %v", err)
	}

	b.ResetTimer()
	for i := 0; i < b.N; i++ {
		_, err := c.InspectPod(context.Background(), &v1alpha.InspectPodRequest{Id: resp.Pods[0].Id})
		if err != nil {
			b.Error(err)
		}
	}
	b.StopTimer()
}