Skip to content

Commit 8f1369a

Browse files
committed
merge main
2 parents 757d5b7 + a034d5b commit 8f1369a

File tree

13 files changed

+949
-11
lines changed

13 files changed

+949
-11
lines changed

.github/workflows/ci.yml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,127 @@ jobs:
321321
if: always()
322322
run: bash ./scripts/dashboard/format_results.sh ${{job.status}} ${{github.job}}/${{matrix.container.image}}-${{matrix.container.version}} ${{github.workspace}}
323323

324+
oss-metrics-tests:
325+
name: Metrics Integration Tests - Official OSS Images
326+
needs: build-unsigned-snapshot
327+
if: ${{ !github.event.pull_request.head.repo.fork && !startsWith(github.head_ref, 'dependabot-') }}
328+
runs-on: ubuntu-22.04
329+
strategy:
330+
matrix:
331+
container:
332+
- image: "bookworm"
333+
version: "stable"
334+
release: "debian"
335+
- image: "bookworm"
336+
version: "mainline"
337+
release: "debian"
338+
- image: "alpine"
339+
version: "stable"
340+
release: "alpine"
341+
- image: "alpine"
342+
version: "mainline"
343+
release: "alpine"
344+
steps:
345+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
346+
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
347+
with:
348+
go-version-file: 'go.mod'
349+
cache: false
350+
- name: Download Packages
351+
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
352+
with:
353+
name: nginx-agent-unsigned-snapshots
354+
path: build
355+
356+
- name: Create Results Directory
357+
run: mkdir -p ${{ github.workspace }}/test/dashboard/logs/${{ github.job }}/${{matrix.container.image}}-${{matrix.container.version}}
358+
359+
- name: Start Promtail
360+
uses: ./.github/actions/start-promtail
361+
with:
362+
loki_url: ${{ secrets.LOKI_DASHBOARD_URL }}
363+
364+
- name: Run Integration Tests
365+
run: |
366+
go install github.com/goreleaser/nfpm/v2/cmd/nfpm@${{ env.NFPM_VERSION }}
367+
CONTAINER_NGINX_IMAGE_REGISTRY="docker-registry.nginx.com" \
368+
TAG="${{ matrix.container.version }}-${{ matrix.container.image }}" \
369+
OS_RELEASE="${{ matrix.container.release }}" OS_VERSION="${{ matrix.container.version }}" \
370+
make metrics-test | tee ${{github.workspace}}/test/dashboard/logs/${{github.job}}/${{matrix.container.image}}-${{matrix.container.version}}/raw_logs.log
371+
exit "${PIPESTATUS[0]}"
372+
373+
- name: Format Results
374+
if: always()
375+
run: bash ./scripts/dashboard/format_results.sh ${{job.status}} ${{github.job}}/${{matrix.container.image}}-${{matrix.container.version}} ${{github.workspace}}
376+
377+
plus-metrics-tests:
378+
name: Metrics Integration Tests - Official Plus Images
379+
needs: build-unsigned-snapshot
380+
if: ${{ !github.event.pull_request.head.repo.fork && !startsWith(github.head_ref, 'dependabot-') }}
381+
runs-on: ubuntu-22.04
382+
strategy:
383+
matrix:
384+
container:
385+
- image: "alpine"
386+
version: "3.22"
387+
plus: "r35"
388+
release: "alpine"
389+
path: "/nginx-plus/agent"
390+
- image: "alpine"
391+
version: "3.21"
392+
plus: "r34"
393+
release: "alpine"
394+
path: "/nginx-plus/agent"
395+
- image: "debian"
396+
version: "bookworm"
397+
plus: "r35"
398+
release: "debian"
399+
path: "/nginx-plus/agent"
400+
- image: "debian"
401+
version: "bookworm"
402+
plus: "r34"
403+
release: "debian"
404+
path: "/nginx-plus/agent"
405+
steps:
406+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
407+
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
408+
with:
409+
go-version-file: 'go.mod'
410+
cache: false
411+
- name: Download Packages
412+
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2
413+
with:
414+
name: nginx-agent-unsigned-snapshots
415+
path: build
416+
- name: Login to Docker Registry
417+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
418+
with:
419+
registry: ${{ secrets.TEST_REGISTRY_URL }}
420+
username: ${{ secrets.REGISTRY_USERNAME }}
421+
password: ${{ secrets.REGISTRY_PASSWORD }}
422+
423+
- name: Create Results Directory
424+
run: mkdir -p ${{ github.workspace }}/test/dashboard/logs/${{ github.job }}/${{matrix.container.image}}-${{matrix.container.version}}
425+
426+
- name: Start Promtail
427+
uses: ./.github/actions/start-promtail
428+
with:
429+
loki_url: ${{ secrets.LOKI_DASHBOARD_URL }}
430+
431+
- name: Run Integration Tests
432+
run: |
433+
go install github.com/goreleaser/nfpm/v2/cmd/nfpm@${{ env.NFPM_VERSION }}
434+
CONTAINER_NGINX_IMAGE_REGISTRY="${{ secrets.TEST_REGISTRY_URL }}" \
435+
TAG="${{ matrix.container.plus }}-${{ matrix.container.image }}-${{ matrix.container.version }}" \
436+
OS_RELEASE="${{ matrix.container.release }}" OS_VERSION="${{ matrix.container.version }}" IMAGE_PATH="${{ matrix.container.path }}" \
437+
NGINX_LICENSE_JWT="${{ secrets.TEST_JWT }}" \
438+
make metrics-test | tee ${{github.workspace}}/test/dashboard/logs/${{github.job}}/${{matrix.container.image}}-${{matrix.container.version}}/raw_logs.log
439+
exit "${PIPESTATUS[0]}"
440+
441+
- name: Format Results
442+
if: always()
443+
run: bash ./scripts/dashboard/format_results.sh ${{job.status}} ${{github.job}}/${{matrix.container.image}}-${{matrix.container.version}} ${{github.workspace}}
444+
324445
performance-tests:
325446
name: Performance Tests
326447
runs-on: ubuntu-22.04

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ build-mock-management-otel-collector:
163163
mkdir -p $(BUILD_DIR)/mock-management-otel-collector
164164
@CGO_ENABLED=0 GOARCH=$(OSARCH) GOOS=linux $(GOBUILD) -o $(BUILD_DIR)/mock-management-otel-collector/collector test/mock/collector/mock-collector/main.go
165165

166-
integration-test: $(SELECTED_PACKAGE) build-mock-management-plane-grpc
166+
integration-test: $(SELECTED_PACKAGE) build-mock-management-plane-grpc
167167
TEST_ENV="Container" CONTAINER_OS_TYPE=$(CONTAINER_OS_TYPE) BUILD_TARGET="install-agent-local" CONTAINER_NGINX_IMAGE_REGISTRY=${CONTAINER_NGINX_IMAGE_REGISTRY} \
168168
PACKAGES_REPO=$(OSS_PACKAGES_REPO) PACKAGE_NAME=$(PACKAGE_NAME) BASE_IMAGE=$(BASE_IMAGE) DOCKERFILE_PATH=$(DOCKERFILE_PATH) IMAGE_PATH=$(IMAGE_PATH) TAG=${IMAGE_TAG} \
169169
OS_VERSION=$(OS_VERSION) OS_RELEASE=$(OS_RELEASE) \
@@ -181,6 +181,13 @@ official-image-integration-test: $(SELECTED_PACKAGE) build-mock-management-plane
181181
OS_VERSION=$(OS_VERSION) OS_RELEASE=$(OS_RELEASE) IMAGE_PATH=$(IMAGE_PATH) \
182182
NGINX_LICENSE_JWT=$(NGINX_LICENSE_JWT) \
183183
go test -v ./test/integration/managementplane ./test/integration/auxiliarycommandserver
184+
185+
metrics-test: $(SELECTED_PACKAGE) build-mock-management-otel-collector
186+
TEST_ENV="Container" CONTAINER_OS_TYPE=$(CONTAINER_OS_TYPE) CONTAINER_NGINX_IMAGE_REGISTRY=${CONTAINER_NGINX_IMAGE_REGISTRY} BUILD_TARGET="install" \
187+
PACKAGES_REPO=$(OSS_PACKAGES_REPO) TAG=${TAG} PACKAGE_NAME=$(PACKAGE_NAME) BASE_IMAGE=$(BASE_IMAGE) DOCKERFILE_PATH=$(OFFICIAL_IMAGE_DOCKERFILE_PATH) \
188+
OS_VERSION=$(OS_VERSION) OS_RELEASE=$(OS_RELEASE) IMAGE_PATH=$(IMAGE_PATH) \
189+
NGINX_LICENSE_JWT=$(NGINX_LICENSE_JWT) \
190+
go test -v ./test/integration/metrics
184191

185192
performance-test:
186193
mkdir -p $(TEST_BUILD_DIR)

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ require (
3636
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/hostmetricsreceiver v0.124.1
3737
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/tcplogreceiver v0.124.1
3838
github.com/open-telemetry/opentelemetry-collector-contrib/testbed v0.124.1
39+
github.com/prometheus/client_model v0.6.1
40+
github.com/prometheus/common v0.62.0
3941
github.com/shirou/gopsutil/v4 v4.25.7
4042
github.com/spf13/pflag v1.0.6
4143
github.com/stretchr/testify v1.10.0
@@ -201,8 +203,6 @@ require (
201203
github.com/pkg/errors v0.9.1 // indirect
202204
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
203205
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
204-
github.com/prometheus/client_model v0.6.1 // indirect
205-
github.com/prometheus/common v0.62.0 // indirect
206206
github.com/prometheus/procfs v0.16.0 // indirect
207207
github.com/rs/cors v1.11.1 // indirect
208208
github.com/sagikazarmark/locafero v0.4.0 // indirect
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
user nginx;
2+
worker_processes 1;
3+
4+
error_log /var/log/nginx/error.log;
5+
pid /var/run/nginx.pid;
6+
7+
events {
8+
worker_connections 1024;
9+
}
10+
11+
http {
12+
default_type application/octet-stream;
13+
14+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
15+
'$status $body_bytes_sent "$http_referer" '
16+
'"$http_user_agent" "$http_x_forwarded_for"'
17+
'"$upstream_cache_status"';
18+
19+
access_log /var/log/nginx/access.log main;
20+
21+
sendfile on;
22+
#tcp_nopush on;
23+
24+
keepalive_timeout 65;
25+
26+
#gzip on;
27+
28+
server {
29+
listen 80 default_server;
30+
server_name localhost;
31+
32+
location /1xx {
33+
return 100 "Success 1xx response code \n";
34+
}
35+
location /2xx {
36+
return 200 "Success 2xx response code \n";
37+
}
38+
39+
location /3xx {
40+
return 300 "Success 3xx response code \n";
41+
}
42+
43+
location /4xx {
44+
return 400 "Success 4xx response code \n";
45+
}
46+
47+
location /5xx {
48+
return 500 "Success 5xx response code \n";
49+
}
50+
51+
location /api {
52+
stub_status;
53+
allow 127.0.0.1;
54+
deny all;
55+
}
56+
57+
error_page 500 502 503 504 /50x.html;
58+
location = /50x.html {
59+
root /usr/share/nginx/html;
60+
}
61+
}
62+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
user nginx;
2+
worker_processes 1;
3+
4+
error_log /var/log/nginx/error.log;
5+
pid /var/run/nginx.pid;
6+
7+
events {
8+
worker_connections 1024;
9+
}
10+
11+
http {
12+
default_type application/octet-stream;
13+
14+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
15+
'$status $body_bytes_sent "$http_referer" '
16+
'"$http_user_agent" "$http_x_forwarded_for"'
17+
'"$upstream_cache_status"';
18+
19+
access_log /var/log/nginx/access.log main;
20+
21+
sendfile on;
22+
#tcp_nopush on;
23+
24+
keepalive_timeout 65;
25+
26+
#gzip on;
27+
28+
server {
29+
listen 80 default_server;
30+
server_name localhost;
31+
32+
location /1xx {
33+
return 100 "Success 1xx response code \n";
34+
}
35+
location /2xx {
36+
return 200 "Success 2xx response code \n";
37+
}
38+
39+
location /3xx {
40+
return 300 "Success 3xx response code \n";
41+
}
42+
43+
location /4xx {
44+
return 400 "Success 4xx response code \n";
45+
}
46+
47+
location /5xx {
48+
return 500 "Success 5xx response code \n";
49+
}
50+
51+
location /api/ {
52+
api write=on;
53+
allow 127.0.0.1;
54+
deny all;
55+
}
56+
57+
error_page 500 502 503 504 /50x.html;
58+
location = /50x.html {
59+
root /usr/share/nginx/html;
60+
}
61+
}
62+
}

0 commit comments

Comments
 (0)