Skip to content

Commit

Permalink
chore: conv bulk ingress tests to perf
Browse files Browse the repository at this point in the history
  • Loading branch information
shaneutt committed Aug 5, 2021
1 parent 9d95ebc commit b0bbb3b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 20 deletions.
16 changes: 0 additions & 16 deletions test/integration/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"net/url"
"os"
"regexp"
"strconv"
"strings"
"testing"
"time"
Expand Down Expand Up @@ -115,9 +114,6 @@ var (
// to persist after the test for inspection. This has a nil effect when an existing cluster
// is provided, as cleanup is not performed for existing clusters.
keepTestCluster = os.Getenv("KONG_TEST_CLUSTER_PERSIST")

// maxBatchSize indicates the maximum number of objects that should be POSTed per second during testing
maxBatchSize = determineMaxBatchSize()
)

// -----------------------------------------------------------------------------
Expand Down Expand Up @@ -259,18 +255,6 @@ func expect404WithNoRoute(t *testing.T, proxyURL string, resp *http.Response) bo
return false
}

// determineMaxBatchSize provides a size limit for the number of resources to POST in a single second during tests, and can be overridden with an ENV var if desired.
func determineMaxBatchSize() int {
if v := os.Getenv("KONG_BULK_TESTING_BATCH_SIZE"); v != "" {
i, err := strconv.Atoi(v)
if err != nil {
panic(fmt.Sprintf("Error: invalid batch size %s: %s", v, err))
}
return i
}
return 50
}

// -----------------------------------------------------------------------------
// Test.MAIN Utility Functions
// -----------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
//+build integration_tests
//+build performance_tests

package integration
package performance

import (
"bytes"
"context"
"fmt"
"net/http"
"strings"
Expand All @@ -23,8 +24,8 @@ import (

// TestIngressBulk attempts to validate functionality at scale by rapidly deploying a large number of ingress resources.
func TestIngressBulk(t *testing.T) {
ns, cleanup := namespace(t)
defer cleanup()
ctx := context.Background()
ns := corev1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: corev1.NamespaceDefault}}

t.Log("deploying a minimal HTTP container to be exoposed via ingress")
container := generators.NewContainer("httpbin", httpBinImage, 80)
Expand Down
16 changes: 16 additions & 0 deletions test/performance/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"net/http"
"net/url"
"os"
"strconv"
"testing"
"time"

Expand Down Expand Up @@ -36,6 +37,9 @@ var (
proxyURL *url.URL
proxyAdminURL *url.URL
proxyUDPURL *url.URL

// maxBatchSize indicates the maximum number of objects that should be POSTed per second during testing
maxBatchSize = determineMaxBatchSize()
)

func TestMain(m *testing.M) {
Expand Down Expand Up @@ -182,3 +186,15 @@ func CleanUpNamespace(ctx context.Context, namespace string, t *testing.T) error
}
return nil
}

// determineMaxBatchSize provides a size limit for the number of resources to POST in a single second during tests, and can be overridden with an ENV var if desired.
func determineMaxBatchSize() int {
if v := os.Getenv("KONG_BULK_TESTING_BATCH_SIZE"); v != "" {
i, err := strconv.Atoi(v)
if err != nil {
panic(fmt.Sprintf("Error: invalid batch size %s: %s", v, err))
}
return i
}
return 50
}

0 comments on commit b0bbb3b

Please sign in to comment.