Skip to content

Commit

Permalink
fix performance test
Browse files Browse the repository at this point in the history
  • Loading branch information
asalan316 committed Jan 10, 2025
1 parent 1c2f421 commit 16dbd01
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -403,14 +403,14 @@ setup-performance: build-test-app acceptance-tests-config
export NODES=1;\
export SUITES="setup_performance";\
export DEPLOYMENT_NAME="autoscaler-performance";\
${CI_DIR}/autoscaler/scripts/run-acceptance-tests.sh;\
make --directory='./src/acceptance' run-acceptance-tests

.PHONY: run-performance
run-performance:
export NODES=1;\
export DEPLOYMENT_NAME="autoscaler-performance";\
export SUITES="run_performance";\
${CI_DIR}/autoscaler/scripts/run-acceptance-tests.sh;\
make --directory='./src/acceptance' run-acceptance-tests

.PHONY: run-act
run-act:
Expand Down
1 change: 1 addition & 0 deletions ci/autoscaler/scripts/run-acceptance-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@ if [ "${suites_to_run}" != "" ]; then
SKIP_TEARDOWN="${skip_teardown}" CONFIG="${PWD}/acceptance_config.json" DEBUG='true' ./bin/test -race -nodes="${nodes}" -trace $ginkgo_opts ${suites_to_run}
else
log 'Nothing to run!'
exit 1
fi
2 changes: 1 addition & 1 deletion src/acceptance/app/custom_metric_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ var _ = Describe("AutoScaler custom metrics", func() {
func sendMetricToAutoscaler(config *config.Config, appToScaleGUID string, metricProducerAppName string, metricThreshold int, mtls bool) func() (int, error) {
return func() (int, error) {
if mtls {
SendMetricMTLS(config, appToScaleGUID, metricProducerAppName, metricThreshold)
SendMetricMTLS(config, appToScaleGUID, metricProducerAppName, metricThreshold, 0)
} else {
SendMetric(config, metricProducerAppName, metricThreshold)
}
Expand Down
8 changes: 6 additions & 2 deletions src/acceptance/helpers/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,13 @@ func SendMetric(cfg *config.Config, appName string, metric int) {
cfh.CurlApp(cfg, appName, fmt.Sprintf("/custom-metrics/test_metric/%d", metric), "-f")
}

func SendMetricMTLS(cfg *config.Config, appGuid string, appName string, metric int) {
func SendMetricMTLS(cfg *config.Config, appGuid string, appName string, metric int, timeOut time.Duration) string {
GinkgoHelper()
cfh.CurlApp(cfg, appName, fmt.Sprintf("/custom-metrics/mtls/test_metric/%d?appToScaleGuid=%s", metric, appGuid), "-f")
if timeOut == 0 {
timeOut = cfh.CURL_TIMEOUT
}
return cfh.CurlAppWithTimeout(cfg, appName, fmt.Sprintf("/custom-metrics/mtls/test_metric/%d?appToScaleGuid=%s",
metric, appGuid), timeOut, "-f")
}

func StartAppWithErr(appName string, timeout time.Duration) error {
Expand Down
4 changes: 2 additions & 2 deletions src/acceptance/run_performance/run_performance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ func scaleOutApp(appName string, appGUID string, scaleOutApps *sync.Map,
// Q. why sending post request to autoscaler after every pollTime.
// A. It is observed that sometime cf does not pick the cf scale event. Therefore,
// sending the metric again(and again) is the way to go at the moment
cmdOutput := helpers.SendMetricWithTimeout(cfg, appName, 550, 5*time.Minute)
cmdOutput := helpers.SendMetricMTLS(cfg, appGUID, appName, 550, 5*time.Minute)
GinkgoWriter.Printf("worker %d - scale-out %s with App %s %s\n",
workerIndex, cmdOutput, appName, appGUID)
instances, err := helpers.RunningInstances(appGUID, 10*time.Minute)
Expand Down Expand Up @@ -354,7 +354,7 @@ func scaleInApp(appName string, appGUID string, scaleInApps *sync.Map, pendingSc
scaledInAppsCount *atomic.Int32, actualAppsToScaleCount int, workerIndex int, wg *sync.WaitGroup) func() {
return func() {
scaleIn := func() (int, error) {
cmdOutput := helpers.SendMetricWithTimeout(cfg, appName, 100, 5*time.Minute)
cmdOutput := helpers.SendMetricMTLS(cfg, appGUID, appName, 100, 5*time.Minute)
GinkgoWriter.Printf("worker %d - scale-in %s with App %s %s\n",
workerIndex, cmdOutput, appName, appGUID)
instances, err := helpers.RunningInstances(appGUID, 10*time.Minute)
Expand Down

0 comments on commit 16dbd01

Please sign in to comment.