Skip to content

Commit afcac2e

Browse files
committed
use correct paths, simplify extraction
1 parent 9909566 commit afcac2e

File tree

3 files changed

+16
-50
lines changed

3 files changed

+16
-50
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ jobs:
7070
make generate-pgo-profile
7171
7272
- name: Archive Load Test CPU profile
73+
id: artifact-upload-step
7374
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
7475
with:
7576
name: cpu-profile
@@ -80,8 +81,8 @@ jobs:
8081
run: |
8182
git config --global user.name 'github-actions'
8283
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
83-
git commit -m "CI Autogenerated" -- profile.pgo || echo "No changes to commit"
84-
# git push
84+
git commit -m "CI Autogenerated" -- ${{ steps.artifact-upload-step.outputs.artifact-id }} || echo "No changes to commit"
85+
git log -1
8586
8687
proxy-sanity-check:
8788
name: Proxy Sanity Check

Makefile

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ PROJECT_FILE = main.go
4747
COLLECTOR_PATH ?= /etc/nginx-agent/opentelemetry-collector-agent.yaml
4848
MANIFEST_DIR ?= /var/lib/nginx-agent
4949
DIRS = $(BUILD_DIR) $(TEST_BUILD_DIR) $(BUILD_DIR)/$(DOCS_DIR) $(BUILD_DIR)/$(DOCS_DIR)/$(PROTO_DIR)
50-
TIME_NOW := $(shell date +%s)
5150
$(shell mkdir -p $(DIRS))
5251

5352
VERSION ?= $(shell git describe --match "v[0-9]*" --abbrev=0 --tags)
@@ -294,9 +293,9 @@ generate-pgo-profile: build-mock-management-plane-grpc ## Generate PGO profile
294293
# run under sudo locally
295294
load-test-image: ## Build performance load testing image
296295
@echo "🚚 Building load test image"
296+
# add --no-cache to the command below to avoid using cache
297297
$(CONTAINER_BUILDENV) $(CONTAINER_CLITOOL) build \
298298
-t $(IMAGE_TAG)_load_test:1.0.0 . \
299-
--no-cache \
300299
-f ./test/docker/load/Dockerfile \
301300
--secret id=nginx-crt,src=$(CERTS_DIR)/nginx-repo.crt \
302301
--secret id=nginx-key,src=$(CERTS_DIR)/nginx-repo.key \
@@ -316,30 +315,17 @@ run-load-test-image: ## Run performance load testing image
316315
# Copy the files generated by the load tests
317316
@$(CONTAINER_CLITOOL) cp \
318317
agent-load-test:/agent/performance/load \
319-
$(TEST_BUILD_DIR)/load
318+
$(TEST_BUILD_DIR)
320319
@echo "Results saved to $(TEST_BUILD_DIR)/load"
321320
@find $(TEST_BUILD_DIR)/load -type f -exec ls -lh {} \;
322321

323-
# Copy the benchmark json to the $(TEST_BUILD_DIR)/load directory for easier access
324-
@$(CONTAINER_CLITOOL) cp \
325-
agent-load-test:/agent/test/load \
326-
$(TEST_BUILD_DIR)/load
327-
@echo "Benchmark results saved to $(TEST_BUILD_DIR)/load/benchmarks.json"
328-
329-
# Copy the results to the $(TEST_BUILD_DIR)/load directory for easier access
330-
@$(CONTAINER_CLITOOL) cp \
331-
agent-load-test:/agent/test/load/results \
332-
$(TEST_BUILD_DIR)/load/
333-
@echo "Benchmark results saved to $(TEST_BUILD_DIR)/load/results"
334-
335322
# Stop and remove the container
336323
@$(CONTAINER_CLITOOL) stop agent-load-test && $(CONTAINER_CLITOOL) rm -f agent-load-test
337324

338325
run-load-test-with-cpu-profiling: ## Run performance load testing with cpu profiling
339326
@echo "🚚 Running load tests with cpu profiling"
340-
@mkdir -p $(TEST_BUILD_DIR)
327+
@mkdir -p $(TEST_BUILD_DIR)/load-cpu-profiling
341328
@$(CONTAINER_CLITOOL) rm -f agent-load-test-with-cpu-profiling || true
342-
@echo "Current epoch time is $(TIME_NOW)"
343329

344330
# Run the load test container
345331
@$(CONTAINER_BUILDENV) $(CONTAINER_CLITOOL) run \
@@ -348,23 +334,11 @@ run-load-test-with-cpu-profiling: ## Run performance load testing with cpu profi
348334
$(IMAGE_TAG)_load_test:1.0.0
349335

350336
# Copy the files generated by the load tests
351-
DIR=profiles/$(TIME_NOW)
352337
@$(CONTAINER_CLITOOL) cp \
353338
agent-load-test-with-cpu-profiling:/agent/performance/load \
354-
$(DIR)
355-
@echo "Benchmarks and profile saved to $(DIR) directory"
356-
357-
# Copy the benchmark results to the root of build directory for easier access
358-
@$(CONTAINER_CLITOOL) cp \
359-
agent-load-test-with-cpu-profiling:/agent/test/load/benchmarks.json \
360-
$(TEST_BUILD_DIR)/load/benchmarks.json
361-
@echo "Benchmark results saved to $(TEST_BUILD_DIR)/load/benchmarks.json"
362-
363-
# Copy the results to the $(TEST_BUILD_DIR)/load directory for easier access
364-
@$(CONTAINER_CLITOOL) cp \
365-
agent-load-test:/agent/test/load/results \
366-
$(TEST_BUILD_DIR)/load
367-
@echo "Benchmark results saved to $(TEST_BUILD_DIR)/load/results"
339+
$(TEST_BUILD_DIR)/load-cpu-profiling
340+
@echo "Results saved to $(TEST_BUILD_DIR)/load-cpu-profiling"
368341

369342
# Stop and remove the container
370-
@$(CONTAINER_CLITOOL) stop agent-load-test-with-cpu-profiling && $(CONTAINER_CLITOOL) rm -f agent-load-test-with-cpu-profiling
343+
@$(CONTAINER_CLITOOL) stop agent-load-test-with-cpu-profiling && \
344+
$(CONTAINER_CLITOOL) rm -f agent-load-test-with-cpu-profiling

test/docker/load/entrypoint.sh

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,29 @@ load_test() {
77
echo "Running load tests..."
88
pushd test/load
99
go test -v -timeout 1m ./...
10-
1110
cp benchmarks.json ${BENCHMARKS_DIR}
12-
cp -r results ${BENCHMARKS_DIR}/results
11+
cp -r results ${BENCHMARKS_DIR}
1312
popd
1413
}
1514

1615
load_test_with_profile() {
1716
echo "Running load tests with CPU Profiling enabled..."
1817
pushd test/load
1918
go test -v -timeout 1m ./... \
20-
-cpuprofile ${BENCHMARKS_DIR}/metrics_load_cpu.pprof
21-
22-
cp benchmarks.json ${BENCHMARKS_DIR}/benchmarks.json
23-
cp -r results ${BENCHMARKS_DIR}/results
24-
19+
-cpuprofile metrics_load_cpu.pprof
20+
cp benchmarks.json ${BENCHMARKS_DIR}
21+
cp -r results ${BENCHMARKS_DIR}
22+
cp *.pprof ${BENCHMARKS_DIR}
2523
popd
2624
}
2725

2826
## Main script execution starts here
2927
mkdir -p ${BENCHMARKS_DIR}
30-
3128
echo "Running in $(pwd)"
32-
# Run load tests
33-
# $PROFILE - if true, run with CPU profiling enabled
3429
if [[ "$PROFILE" == "true" ]]; then
3530
echo "CPU Profiling is enabled."
36-
load_test_with_profile || { echo "Load tests with profiling failed"; exit 1; }
31+
load_test_with_profile || { echo "Load tests with cpu profiling failed"; exit 1; }
3732
else
3833
load_test || { echo "Load tests failed"; exit 1; }
3934
fi
40-
41-
echo "Listing contents of ${BENCHMARKS_DIR}:"
42-
ls -la ${BENCHMARKS_DIR}
43-
4435
echo "Done."

0 commit comments

Comments
 (0)