@@ -46,6 +46,7 @@ PROJECT_FILE = main.go
4646COLLECTOR_PATH ?= /etc/nginx-agent/opentelemetry-collector-agent.yaml
4747MANIFEST_DIR ?= /var/lib/nginx-agent
4848DIRS = $(BUILD_DIR ) $(TEST_BUILD_DIR ) $(BUILD_DIR ) /$(DOCS_DIR ) $(BUILD_DIR ) /$(DOCS_DIR ) /$(PROTO_DIR )
49+ TIME_NOW := $(shell date +% s)
4950$(shell mkdir -p $(DIRS))
5051
5152VERSION ?= $(shell git describe --match "v[0-9]* " --abbrev=0 --tags)
@@ -289,49 +290,78 @@ generate-pgo-profile: build-mock-management-plane-grpc ## Generate PGO profile
289290
290291# run under sudo locally
291292load-test-image : # # Build performance load testing image
292- @echo " 🚚 Building load test image"
293+ @echo " 🚚 Building load test image"
293294 $(CONTAINER_BUILDENV ) $(CONTAINER_CLITOOL ) build \
294295 -t $(IMAGE_TAG ) _load_test:1.0.0 . \
296+ --no-cache \
295297 -f ./test/docker/load/Dockerfile \
296298 --secret id=nginx-crt,src=$(CERTS_DIR ) /nginx-repo.crt \
297299 --secret id=nginx-key,src=$(CERTS_DIR ) /nginx-repo.key \
298300 --build-arg OSARCH=$(OSARCH ) \
299301 --build-arg GO_VERSION=$(GO_VERSION )
300302
301303run-load-test-image : # # Run performance load testing image
302- @echo " 🚚 Running load tests"
304+ @mkdir -p $(TEST_BUILD_DIR ) /load
305+ @echo " 🚚 Running load tests"
303306 $(CONTAINER_CLITOOL ) rm -f agent-load-test || true
304307
305- # # Run the load test container
308+ # Run the load test container
306309 @$(CONTAINER_BUILDENV) $(CONTAINER_CLITOOL) run \
307310 --name agent-load-test \
308311 $(IMAGE_TAG)_load_test:1.0.0
309312
310- # Copy the files generated by the load tests
313+ # Copy the files generated by the load tests
311314 @$(CONTAINER_CLITOOL) cp \
312- agent-load-test:/agent/performance/load-tests \
315+ agent-load-test:/agent/performance/load \
313316 $(TEST_BUILD_DIR)/load
314- @echo "Benchmarks saved to $(TEST_BUILD_DIR)/load"
317+ @echo "Results saved to $(TEST_BUILD_DIR)/load"
315318 @find $(TEST_BUILD_DIR)/load -type f -exec ls -lh {} \;
316319
317- # # Stop and remove the container
318- $(CONTAINER_CLITOOL) stop agent-load-test && $(CONTAINER_CLITOOL) rm -f agent-load-test
320+ # Copy the benchmark json to the $(TEST_BUILD_DIR)/load directory for easier access
321+ @$(CONTAINER_CLITOOL) cp \
322+ agent-load-test:/agent/test/load \
323+ $(TEST_BUILD_DIR)/load
324+ @echo "Benchmark results saved to $(TEST_BUILD_DIR)/load/benchmarks.json"
325+
326+ # Copy the results to the $(TEST_BUILD_DIR)/load directory for easier access
327+ @$(CONTAINER_CLITOOL) cp \
328+ agent-load-test:/agent/test/load/results \
329+ $(TEST_BUILD_DIR)/load/
330+ @echo "Benchmark results saved to $(TEST_BUILD_DIR)/load/results"
331+
332+ # Stop and remove the container
333+ @$(CONTAINER_CLITOOL) stop agent-load-test && $(CONTAINER_CLITOOL) rm -f agent-load-test
319334
320335run-load-test-with-cpu-profiling : # # Run performance load testing with cpu profiling
321- @echo " 🚚 Running load tests with cpu profiling"
336+ @echo " 🚚 Running load tests with cpu profiling"
337+ @mkdir -p $(TEST_BUILD_DIR )
322338 @$(CONTAINER_CLITOOL ) rm -f agent-load-test-with-cpu-profiling || true
339+ @echo " Current epoch time is $( TIME_NOW) "
323340
324- # # Run the load test container
341+ # Run the load test container
325342 @$(CONTAINER_BUILDENV) $(CONTAINER_CLITOOL) run \
326343 --name agent-load-test-with-cpu-profiling \
327344 --env PROFILE=true \
328345 $(IMAGE_TAG)_load_test:1.0.0
329346
330- # Copy the files generated by the load tests
347+ # Copy the files generated by the load tests
348+ DIR=profiles/$(TIME_NOW)
331349 @$(CONTAINER_CLITOOL) cp \
332- agent-load-test-with-cpu-profiling:/agent/performance/load-tests \
333- profiles
334- @echo "Benchmarks and profile saved to profiles directory"
350+ agent-load-test-with-cpu-profiling:/agent/performance/load \
351+ $(DIR)
352+ @echo "Benchmarks and profile saved to $(DIR) directory"
353+
354+ # Copy the benchmark results to the root of build directory for easier access
355+ @$(CONTAINER_CLITOOL) cp \
356+ agent-load-test-with-cpu-profiling:/agent/test/load/benchmarks.json \
357+ $(TEST_BUILD_DIR)/load/benchmarks.json
358+ @echo "Benchmark results saved to $(TEST_BUILD_DIR)/load/benchmarks.json"
359+
360+ # Copy the results to the $(TEST_BUILD_DIR)/load directory for easier access
361+ @$(CONTAINER_CLITOOL) cp \
362+ agent-load-test:/agent/test/load/results \
363+ $(TEST_BUILD_DIR)/load
364+ @echo "Benchmark results saved to $(TEST_BUILD_DIR)/load/results"
335365
336- # Stop and remove the container
366+ # Stop and remove the container
337367 @$(CONTAINER_CLITOOL) stop agent-load-test-with-cpu-profiling && $(CONTAINER_CLITOOL) rm -f agent-load-test-with-cpu-profiling
0 commit comments