Skip to content

Commit 0a6a7f0

Browse files
committed
feat: add E2E tests with real Puppet agent runs and code deployment
Add openvox-code OCI image with production/staging/broken Puppet environments, openvox-mock server (ENC + report + PuppetDB receiver), Helm ReportProcessor template, and 7 Chainsaw E2E test scenarios covering the full Puppet lifecycle (basic, concurrent, idempotent, broken catalog, ENC integration, report forwarding, full stack). Closes #60
1 parent 492dd34 commit 0a6a7f0

30 files changed

Lines changed: 1613 additions & 0 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Container Build (Test Images)
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'images/openvox-agent/**'
8+
- 'images/openvox-code/**'
9+
- 'images/openvox-mock/**'
10+
- 'cmd/mock/**'
11+
workflow_dispatch:
12+
13+
jobs:
14+
openvox-agent:
15+
uses: ./.github/workflows/container-build.yaml
16+
permissions:
17+
contents: read
18+
packages: write
19+
with:
20+
image_name: openvox-agent
21+
dockerfile: images/openvox-agent/Containerfile
22+
context: 'images/openvox-agent'
23+
24+
openvox-code:
25+
uses: ./.github/workflows/container-build.yaml
26+
permissions:
27+
contents: read
28+
packages: write
29+
with:
30+
image_name: openvox-code
31+
dockerfile: images/openvox-code/Containerfile
32+
context: '.'
33+
34+
openvox-mock:
35+
uses: ./.github/workflows/container-build.yaml
36+
permissions:
37+
contents: read
38+
packages: write
39+
with:
40+
image_name: openvox-mock
41+
dockerfile: images/openvox-mock/Containerfile
42+
context: '.'

.github/workflows/e2e.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: E2E
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
e2e:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v6
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Set up Go
19+
uses: actions/setup-go@v6
20+
with:
21+
go-version-file: go.mod
22+
23+
- name: Create kind cluster
24+
uses: helm/kind-action@v1
25+
with:
26+
config: tests/e2e/kind-config.yaml
27+
28+
- name: Build images
29+
run: |
30+
LOCAL_TAG=$(git describe --always)
31+
docker build -t openvox-operator:${LOCAL_TAG} -f images/openvox-operator/Containerfile .
32+
docker build -t openvox-server:${LOCAL_TAG} -f images/openvox-server/Containerfile .
33+
docker build -t openvox-code:latest -f images/openvox-code/Containerfile .
34+
docker build -t openvox-agent:latest -f images/openvox-agent/Containerfile images/openvox-agent/
35+
docker build -t openvox-mock:latest -f images/openvox-mock/Containerfile .
36+
37+
- name: Load images into kind
38+
run: |
39+
LOCAL_TAG=$(git describe --always)
40+
kind load docker-image openvox-operator:${LOCAL_TAG}
41+
kind load docker-image openvox-server:${LOCAL_TAG}
42+
kind load docker-image openvox-code:latest
43+
kind load docker-image openvox-agent:latest
44+
kind load docker-image openvox-mock:latest
45+
46+
- name: Install operator
47+
run: |
48+
LOCAL_TAG=$(git describe --always)
49+
helm upgrade --install openvox-operator charts/openvox-operator \
50+
--namespace openvox-system --create-namespace \
51+
--set image.repository=openvox-operator \
52+
--set image.tag=${LOCAL_TAG} \
53+
--set image.pullPolicy=Never
54+
kubectl wait --for=condition=Available deployment/openvox-operator \
55+
-n openvox-system --timeout=2m
56+
57+
- name: Run E2E tests
58+
run: go tool chainsaw test tests/e2e/
59+
60+
- name: Collect debug info
61+
if: failure()
62+
run: |
63+
echo "=== Operator logs ==="
64+
kubectl logs -n openvox-system deploy/openvox-operator --tail=100 || true
65+
echo "=== All pods ==="
66+
kubectl get pods -A || true
67+
echo "=== Events ==="
68+
kubectl get events -A --sort-by=.lastTimestamp || true

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
IMG ?= ghcr.io/slauger/openvox-operator:latest
22
OPENVOX_SERVER_IMG ?= ghcr.io/slauger/openvox-server:latest
3+
OPENVOX_CODE_IMG ?= ghcr.io/slauger/openvox-code:latest
4+
OPENVOX_AGENT_IMG ?= ghcr.io/slauger/openvox-agent:latest
5+
OPENVOX_MOCK_IMG ?= ghcr.io/slauger/openvox-mock:latest
36
NAMESPACE ?= openvox-system
47
CONTAINER_TOOL ?= $(shell which podman 2>/dev/null || which docker 2>/dev/null)
58
CONTROLLER_GEN = go tool controller-gen
@@ -58,8 +61,14 @@ LOCAL_TAG ?= $(shell git describe --always)
5861
local-build: ## Build all images for local development (Docker Desktop K8s).
5962
$(CONTAINER_TOOL) build -t openvox-operator:$(LOCAL_TAG) -f images/openvox-operator/Containerfile .
6063
$(CONTAINER_TOOL) build -t openvox-server:$(LOCAL_TAG) -f images/openvox-server/Containerfile .
64+
$(CONTAINER_TOOL) build -t openvox-code:latest -f images/openvox-code/Containerfile .
65+
$(CONTAINER_TOOL) build -t openvox-agent:latest -f images/openvox-agent/Containerfile images/openvox-agent/
66+
$(CONTAINER_TOOL) build -t openvox-mock:latest -f images/openvox-mock/Containerfile .
6167
@echo "Built openvox-operator:$(LOCAL_TAG)"
6268
@echo "Built openvox-server:$(LOCAL_TAG)"
69+
@echo "Built openvox-code:latest"
70+
@echo "Built openvox-agent:latest"
71+
@echo "Built openvox-mock:latest"
6372

6473
.PHONY: local-deploy
6574
local-deploy: local-build local-install ## Build images and deploy operator via Helm.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
signingPolicies:
2+
- name: autosign-any
3+
any: true
4+
5+
config:
6+
code:
7+
image: openvox-code:latest
8+
imagePullPolicy: Never
9+
10+
servers:
11+
- name: ca
12+
ca: true
13+
server: true
14+
poolRefs: [ca, server]
15+
certificate:
16+
certname: puppet
17+
dnsAltNames:
18+
- e2e-agent-basic-server
19+
- e2e-agent-concurrent-server
20+
- e2e-agent-idempotent-server
21+
- e2e-agent-broken-server
22+
replicas: 1
23+
resources:
24+
requests:
25+
cpu: 250m
26+
memory: 512Mi
27+
limits:
28+
memory: 1Gi
29+
30+
pools:
31+
- name: ca
32+
service:
33+
type: ClusterIP
34+
port: 8140
35+
- name: server
36+
service:
37+
type: ClusterIP
38+
port: 8140
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
signingPolicies:
2+
- name: autosign-any
3+
any: true
4+
5+
config:
6+
code:
7+
image: openvox-code:latest
8+
imagePullPolicy: Never
9+
10+
nodeClassifier:
11+
enabled: true
12+
url: http://openvox-mock:8080
13+
request:
14+
method: GET
15+
path: /node/{certname}
16+
response:
17+
format: yaml
18+
19+
servers:
20+
- name: ca
21+
ca: true
22+
server: true
23+
poolRefs: [ca, server]
24+
certificate:
25+
certname: puppet
26+
dnsAltNames:
27+
- e2e-agent-enc-server
28+
replicas: 1
29+
resources:
30+
requests:
31+
cpu: 250m
32+
memory: 512Mi
33+
limits:
34+
memory: 1Gi
35+
36+
pools:
37+
- name: ca
38+
service:
39+
type: ClusterIP
40+
port: 8140
41+
- name: server
42+
service:
43+
type: ClusterIP
44+
port: 8140
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
signingPolicies:
2+
- name: autosign-any
3+
any: true
4+
5+
config:
6+
puppet:
7+
reports: "store,webhook"
8+
code:
9+
image: openvox-code:latest
10+
imagePullPolicy: Never
11+
12+
nodeClassifier:
13+
enabled: true
14+
url: http://openvox-mock:8080
15+
request:
16+
method: GET
17+
path: /node/{certname}
18+
response:
19+
format: yaml
20+
21+
reportProcessors:
22+
- name: e2e-full-webhook
23+
url: http://openvox-mock:8080/reports
24+
- name: e2e-full-puppetdb
25+
url: http://openvox-mock:8080/pdb/cmd/v1
26+
processor: puppetdb
27+
28+
servers:
29+
- name: ca
30+
ca: true
31+
server: true
32+
poolRefs: [ca, server]
33+
certificate:
34+
certname: puppet
35+
dnsAltNames:
36+
- e2e-agent-full-server
37+
replicas: 1
38+
resources:
39+
requests:
40+
cpu: 250m
41+
memory: 512Mi
42+
limits:
43+
memory: 1Gi
44+
45+
pools:
46+
- name: ca
47+
service:
48+
type: ClusterIP
49+
port: 8140
50+
- name: server
51+
service:
52+
type: ClusterIP
53+
port: 8140
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
signingPolicies:
2+
- name: autosign-any
3+
any: true
4+
5+
config:
6+
puppet:
7+
reports: "store,webhook"
8+
code:
9+
image: openvox-code:latest
10+
imagePullPolicy: Never
11+
12+
reportProcessors:
13+
- name: e2e-report-webhook
14+
url: http://openvox-mock:8080/reports
15+
- name: e2e-report-puppetdb
16+
url: http://openvox-mock:8080/pdb/cmd/v1
17+
processor: puppetdb
18+
19+
servers:
20+
- name: ca
21+
ca: true
22+
server: true
23+
poolRefs: [ca, server]
24+
certificate:
25+
certname: puppet
26+
dnsAltNames:
27+
- e2e-agent-report-server
28+
replicas: 1
29+
resources:
30+
requests:
31+
cpu: 250m
32+
memory: 512Mi
33+
limits:
34+
memory: 1Gi
35+
36+
pools:
37+
- name: ca
38+
service:
39+
type: ClusterIP
40+
port: 8140
41+
- name: server
42+
service:
43+
type: ClusterIP
44+
port: 8140

charts/openvox-stack/templates/_helpers.tpl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,18 @@ Usage: include "openvox-stack.certName" (dict "root" $ "entry" $entry)
6767
{{- end }}
6868
{{- end }}
6969

70+
{{/*
71+
ReportProcessor name for array entries.
72+
Usage: include "openvox-stack.reportProcessorName" (dict "root" $ "entry" $entry "index" $i)
73+
*/}}
74+
{{- define "openvox-stack.reportProcessorName" -}}
75+
{{- if .entry.name -}}
76+
{{- .entry.name }}
77+
{{- else -}}
78+
{{- printf "%s-report-processor-%d" (include "openvox-stack.fullname" .root) .index | trunc 63 | trimSuffix "-" }}
79+
{{- end }}
80+
{{- end }}
81+
7082
{{/*
7183
Pool name for a pool entry.
7284
Usage: include "openvox-stack.poolName" (dict "root" $ "entry" $entry)

0 commit comments

Comments
 (0)