From 26006af4e0eb39f2932b06d49adfb61a85bc364b Mon Sep 17 00:00:00 2001 From: Shyam Jeedigunta Date: Fri, 14 Jul 2017 00:12:47 +0200 Subject: [PATCH] Group every two services into one in load test --- test/e2e/scalability/load.go | 16 ++++++++++++++-- test/utils/runners.go | 6 ++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/test/e2e/scalability/load.go b/test/e2e/scalability/load.go index 1248e4ee0a..b631056092 100644 --- a/test/e2e/scalability/load.go +++ b/test/e2e/scalability/load.go @@ -61,6 +61,7 @@ const ( nodeCountPerNamespace = 100 // How many threads will be used to create/delete services during this test. serviceOperationsParallelism = 1 + svcLabelKey = "svc-label" ) var randomKind = schema.GroupKind{Kind: "Random"} @@ -458,6 +459,8 @@ func GenerateConfigsForGroup( MemRequest: 26214400, // 25MB SecretNames: secretNames, ConfigMapNames: configMapNames, + // Define a label to group every 2 RCs into one service. + Labels: map[string]string{svcLabelKey: groupName + "-" + strconv.Itoa((i+1)/2)}, } if kind == randomKind { @@ -483,10 +486,19 @@ func GenerateConfigsForGroup( } func generateServicesForConfigs(configs []testutils.RunObjectConfig) []*v1.Service { - services := make([]*v1.Service, 0, len(configs)) + services := make([]*v1.Service, 0) + currentSvcLabel := "" for _, config := range configs { + svcLabel, found := config.GetLabelValue(svcLabelKey) + if !found || svcLabel == currentSvcLabel { + continue + } + currentSvcLabel = svcLabel serviceName := config.GetName() + "-svc" - labels := map[string]string{"name": config.GetName()} + labels := map[string]string{ + "name": config.GetName(), + svcLabelKey: currentSvcLabel, + } service := &v1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: serviceName, diff --git a/test/utils/runners.go b/test/utils/runners.go index da1feb03d1..82d5db886b 100644 --- a/test/utils/runners.go +++ b/test/utils/runners.go @@ -108,6 +108,7 @@ type RunObjectConfig interface { SetClient(clientset.Interface) SetInternalClient(internalclientset.Interface) GetReplicas() int + GetLabelValue(string) (string, bool) } type RCConfig struct { @@ -500,6 +501,11 @@ func (config *RCConfig) GetReplicas() int { return config.Replicas } +func (config *RCConfig) GetLabelValue(key string) (string, bool) { + value, found := config.Labels[key] + return value, found +} + func (config *RCConfig) create() error { dnsDefault := v1.DNSDefault if config.DNSPolicy == nil {