diff --git a/test/performance/framework/service/scale_up.go b/test/performance/framework/service/scale_up.go index bf2acaba8f5..b27f502b693 100644 --- a/test/performance/framework/service/scale_up.go +++ b/test/performance/framework/service/scale_up.go @@ -125,10 +125,6 @@ func ScaleUp(ctx context.Context, provider providers.ProviderInterface, controlP klog.InfoS("retrieveCIDRs", "svcCIDRs", svcCIDRs) svcCIDRIPv4 = svcCIDRs[0] _, ipNet, _ := net.ParseCIDR(svcCIDRIPv4) - // var parsedIPs []net.IP - // for _, ip := range reservedIPs { - // parsedIPs = append(parsedIPs, net.ParseIP(ip)) - // } allocator, err := ipallocator.NewCIDRAllocator(ipNet, []net.IP{net.ParseIP("10.96.0.1"), net.ParseIP("10.96.0.10")}) for _, ns := range nss { @@ -152,7 +148,7 @@ func ScaleUp(ctx context.Context, provider providers.ProviderInterface, controlP } var fromPod *corev1.Pod - if testPodIndex < len(podList.Items) { + if testPodIndex < len(podList.Items) && actualCheckNum < cap(ch) { fromPod = &podList.Items[testPodIndex] testPodIndex++ @@ -166,7 +162,7 @@ func ScaleUp(ctx context.Context, provider providers.ProviderInterface, controlP var newSvc *corev1.Service var err error svc.Spec.ClusterIP = clusterIP.String() - startTimeStamp := time.Now().Nanosecond() + startTimeStamp := time.Now().UnixNano() newSvc, err = cs.CoreV1().Services(ns).Create(ctx, svc, metav1.CreateOptions{}) if err != nil { if errors.IsAlreadyExists(err) { diff --git a/test/performance/utils/exec.go b/test/performance/utils/exec.go index e638b7155ae..c8cd0da4cda 100644 --- a/test/performance/utils/exec.go +++ b/test/performance/utils/exec.go @@ -100,7 +100,7 @@ func PingIP(ctx context.Context, kubeConfig *rest.Config, kc kubernetes.Interfac return nil } -func extractNanoseconds(logEntry string) (int, error) { +func extractNanoseconds(logEntry string) (int64, error) { re := regexp.MustCompile(`(\d+)\s+Status changed from (unknown|down)? to up after`) matches := re.FindStringSubmatch(logEntry) @@ -114,10 +114,10 @@ func extractNanoseconds(logEntry string) (int, error) { return 0, fmt.Errorf("error converting nanoseconds to integer: %v", err) } - return nanoseconds, nil + return int64(nanoseconds), nil } -func FetchTimestampFromLog(ctx context.Context, kc kubernetes.Interface, namespace, podName, containerName string, ch chan time.Duration, startTime int) error { +func FetchTimestampFromLog(ctx context.Context, kc kubernetes.Interface, namespace, podName, containerName string, ch chan time.Duration, startTime int64) error { return wait.Poll(defaultInterval, defaultTimeout, func() (done bool, err error) { req := kc.CoreV1().Pods(namespace).GetLogs(podName, &corev1.PodLogOptions{ Container: containerName, diff --git a/test/performance/utils/exec_test.go b/test/performance/utils/exec_test.go index ae6902f9150..22e93802d7b 100644 --- a/test/performance/utils/exec_test.go +++ b/test/performance/utils/exec_test.go @@ -26,5 +26,4 @@ func TestExtractSeconds(t *testing.T) { } fmt.Println(res) } - }