test: Copy Helm CI tests into new framework (#19008)

pull/19121/head
nicolevanderhoeven 9 months ago committed by GitHub
parent 65de5f95db
commit 62cec3e842
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 49
      production/helm/loki/test/integration/distributed-advanced/log-generator.yaml
  2. 73
      production/helm/loki/test/integration/distributed-advanced/non-default-values.yaml
  3. 131
      production/helm/loki/test/integration/distributed-advanced/test-plan.yaml
  4. 48
      production/helm/loki/test/integration/enterprise/enterprise.yaml
  5. 50
      production/helm/loki/test/integration/enterprise/log-generator.yaml
  6. 17
      production/helm/loki/test/integration/enterprise/monitoring-secret.yaml
  7. 93
      production/helm/loki/test/integration/enterprise/test-plan.yaml
  8. 30
      production/helm/loki/test/integration/ingress/ingress-values.yaml
  9. 2
      production/helm/loki/test/integration/ingress/test-plan.yaml
  10. 19
      production/helm/loki/test/integration/single-binary/default-single-binary-values.yaml
  11. 2
      production/helm/loki/test/integration/single-binary/test-plan.yaml
  12. 16
      production/helm/loki/test/integration/ssd/default-values.yaml
  13. 50
      production/helm/loki/test/integration/ssd/log-generator.yaml
  14. 92
      production/helm/loki/test/integration/ssd/test-plan.yaml

@ -0,0 +1,49 @@
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: HelmRepository
metadata:
name: grafana
namespace: default
spec:
interval: 1m
url: https://grafana.github.io/helm-charts
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: log-generator
namespace: default
spec:
interval: 1m
chart:
spec:
chart: alloy
sourceRef:
kind: HelmRepository
name: grafana
namespace: default
interval: 1m
values:
controller:
type: deployment
alloy:
configMap:
content: |
logging {
level = "debug"
write_to = [loki.relabel.default.receiver]
}
loki.relabel "default" {
rule {
target_label = "source"
replacement = "log-generator"
}
forward_to = [loki.write.default.receiver]
}
loki.write "default" {
endpoint {
url = "http://loki-gateway.loki.svc/loki/api/v1/push"
}
}

@ -0,0 +1,73 @@
deploymentMode: Distributed
loki:
commonConfig:
replication_factor: 1
useTestSchema: true
auth_enabled: false
storage:
bucketNames:
chunks: chunks
ruler: ruler
admin: admin
tenants:
- name: "test-user-1"
password: "test-password-1"
- name: "test-user-2"
passwordHash: "$2y$10$7O40CaY1yz7fu9O24k2/u.ct/wELYHRBsn25v/7AyuQ8E8hrLqpva"
ingester:
replicas: 1
zoneAwareReplication:
enabled: false
minio:
enabled: true
read:
replicas: 0
write:
replicas: 0
backend:
replicas: 0
ruler:
replicas: 1
distributor:
replicas: 1
memcached:
enabled: true
replicas: 1
compactor:
replicas: 1
indexGateway:
replicas: 1
querier:
replicas: 1
queryFrontend:
replicas: 1
queryScheduler:
replicas: 1
lokiCanary:
kind: Deployment
chunksCache:
suffix: "l1"
enabled: true
allocatedMemory: 128
persistence:
labels:
foo: bar
baz: qux
l2:
enabled: true
replicas: 2
allocatedMemory: 128
persistence:
labels:
foo: bar
baz: qux
resultsCache:
allocatedMemory: 128
persistence:
labels:
foo: bar
baz: qux
gateway:
enabled: true
basicAuth:
enabled: false

@ -0,0 +1,131 @@
---
apiVersion: helm-chart-toolbox.grafana.com/v1
kind: TestPlan
name: distributed-advanced
subject:
releaseName: loki
namespace: loki
path: ../../..
valuesFile: non-default-values.yaml
extraArgs:
- --dependency-update
- --set
- "chunksCache.allocatedMemory=128"
cluster:
type: kind
dependencies:
- file: log-generator.yaml
- preset: grafana
overrides:
datasources:
datasources.yaml:
apiVersion: 1
datasources:
- name: Loki
type: loki
url: http://loki-gateway.loki.svc/loki/api/v1/query
isDefault: true
tests:
- type: kubernetes-objects-test
values:
checks:
# Individual microservices (distributed mode)
- kind: StatefulSet
name: loki-ruler
namespace: loki
- kind: StatefulSet
name: loki-ingester
namespace: loki
- kind: Deployment
name: loki-distributor
namespace: loki
- kind: StatefulSet
name: loki-compactor
namespace: loki
- kind: StatefulSet
name: loki-index-gateway
namespace: loki
- kind: Deployment
name: loki-querier
namespace: loki
- kind: Deployment
name: loki-query-frontend
namespace: loki
- kind: Deployment
name: loki-query-scheduler
namespace: loki
- kind: Deployment
name: loki-gateway
namespace: loki
# Caching components
- kind: StatefulSet
name: loki-chunks-cache-l1
namespace: loki
- kind: StatefulSet
name: loki-chunks-cache-l2
namespace: loki
- kind: StatefulSet
name: loki-results-cache
namespace: loki
# MinIO for storage
- kind: StatefulSet
name: loki-minio
namespace: loki
# Services for all components
- kind: Service
name: loki-ruler
namespace: loki
- kind: Service
name: loki-ingester
namespace: loki
- kind: Service
name: loki-distributor
namespace: loki
- kind: Service
name: loki-compactor
namespace: loki
- kind: Service
name: loki-index-gateway
namespace: loki
- kind: Service
name: loki-querier
namespace: loki
- kind: Service
name: loki-query-frontend
namespace: loki
- kind: Service
name: loki-query-scheduler
namespace: loki
- kind: Service
name: loki-gateway
namespace: loki
- kind: Service
name: loki-chunks-cache-l1
namespace: loki
- kind: Service
name: loki-chunks-cache-l2
namespace: loki
- kind: Service
name: loki-results-cache
namespace: loki
- kind: Service
name: loki-minio
namespace: loki
- kind: Service
name: loki-memberlist
namespace: loki
- type: query-test
values:
tests:
- env:
LOKI_URL: http://loki-gateway.loki.svc/loki/api/v1/query
queries:
- query: count_over_time({source="log-generator"}[1h])
type: logql

@ -0,0 +1,48 @@
---
enterprise:
enabled: true
provisioner:
enabled: false
license:
contents: "NOTAVALIDLICENSE_BUT_SUFFICIENT_FOR_TESTING_PURPOSES"
config: |
auth:
type: trust
auth_enabled: false
cluster_name: {{ .Release.Name }}
license:
path: /etc/loki/license/license.jwt
loki:
commonConfig:
replication_factor: 1
image:
tag: "main-5e53303"
useTestSchema: true
storage:
bucketNames:
chunks: chunks
ruler: ruler
admin: admin
minio:
enabled: true
deploymentMode: SimpleScalable
lokiCanary:
enabled: true
read:
replicas: 1
write:
replicas: 1
persistence:
enabled: true
size: 100Mi
backend:
replicas: 1
persistence:
enabled: true
size: 100Mi
monitoring:
serviceMonitor:
labels:
release: "prometheus"
test:
prometheusAddress: "http://prometheus-kube-prometheus-prometheus.prometheus.svc.cluster.local.:9090"

@ -0,0 +1,50 @@
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: HelmRepository
metadata:
name: grafana
namespace: default
spec:
interval: 1m
url: https://grafana.github.io/helm-charts
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: log-generator
namespace: default
spec:
interval: 1m
chart:
spec:
chart: alloy
sourceRef:
kind: HelmRepository
name: grafana
namespace: default
interval: 1m
values:
controller:
type: deployment
alloy:
configMap:
content: |
logging {
level = "debug"
write_to = [loki.relabel.default.receiver]
}
loki.relabel "default" {
rule {
target_label = "source"
replacement = "log-generator"
}
forward_to = [loki.write.default.receiver]
}
loki.write "default" {
endpoint {
url = "http://loki-enterprise-logs-gateway.loki.svc/loki/api/v1/push"
tenant_id = "1"
}
}

@ -0,0 +1,17 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: loki
---
apiVersion: v1
kind: Secret
metadata:
name: enterprise-logs-provisioned-self-monitoring
namespace: loki
type: Opaque
data:
# Base64 encoded "test-user"
username: dGVzdC11c2Vy
# Base64 encoded "test-password"
password: dGVzdC1wYXNzd29yZA==

@ -0,0 +1,93 @@
---
apiVersion: helm-chart-toolbox.grafana.com/v1
kind: TestPlan
name: enterprise
subject:
releaseName: loki
namespace: loki
path: ../../..
valuesFile: enterprise.yaml
extraArgs:
- --dependency-update
- --set
- "chunksCache.allocatedMemory=1024"
cluster:
type: kind
dependencies:
- file: monitoring-secret.yaml
- file: log-generator.yaml
- preset: grafana
overrides:
datasources:
datasources.yaml:
apiVersion: 1
datasources:
- name: Loki
type: loki
url: http://loki.loki.svc:3100/
isDefault: true
jsonData:
httpHeaderName1: X-Scope-OrgID
secureJsonData:
httpHeaderValue1: "1"
tests:
- type: kubernetes-objects-test
values:
checks:
- kind: StatefulSet
name: enterprise-logs-backend
namespace: loki
- kind: StatefulSet
name: enterprise-logs-write
namespace: loki
- kind: StatefulSet
name: loki-enterprise-logs-chunks-cache
namespace: loki
- kind: StatefulSet
name: loki-enterprise-logs-results-cache
namespace: loki
- kind: Deployment
name: enterprise-logs-read
namespace: loki
- kind: Deployment
name: loki-enterprise-logs-gateway
namespace: loki
# Loki services
- kind: Service
name: enterprise-logs-backend
namespace: loki
- kind: Service
name: enterprise-logs-read
namespace: loki
- kind: Service
name: enterprise-logs-write
namespace: loki
- kind: Service
name: enterprise-logs-canary
namespace: loki
- kind: Service
name: loki-enterprise-logs-chunks-cache
namespace: loki
- kind: Service
name: loki-enterprise-logs-gateway
namespace: loki
- kind: Service
name: enterprise-logs-memberlist
namespace: loki
- kind: Service
name: loki-enterprise-logs-results-cache
namespace: loki
- type: query-test
values:
tests:
- env:
LOKI_URL: http://loki-enterprise-logs-gateway.loki.svc/loki/api/v1/query
LOKI_TENANTID: 1
queries:
- query: count_over_time({source="log-generator"}[1h])
type: logql

@ -0,0 +1,30 @@
---
gateway:
ingress:
enabled: true
annotations: {}
hosts:
- host: gateway.loki.example.com
paths:
- path: /
pathType: Prefix
loki:
commonConfig:
replication_factor: 1
useTestSchema: true
storage:
bucketNames:
chunks: chunks
ruler: ruler
admin: admin
read:
replicas: 1
write:
replicas: 1
backend:
replicas: 1
monitoring:
lokiCanary:
enabled: false
test:
enabled: false

@ -6,7 +6,7 @@ subject:
releaseName: loki
namespace: loki
path: ../../..
valuesFile: ../../../ci/ingress-values.yaml
valuesFile: ingress-values.yaml
extraArgs:
- --dependency-update
- --set

@ -0,0 +1,19 @@
---
loki:
commonConfig:
replication_factor: 1
useTestSchema: true
storage:
bucketNames:
chunks: chunks
ruler: ruler
admin: admin
deploymentMode: SingleBinary
singleBinary:
replicas: 1
read:
replicas: 0
write:
replicas: 0
backend:
replicas: 0

@ -6,7 +6,7 @@ subject:
releaseName: loki
namespace: loki
path: ../../..
valuesFile: ../../../ci/default-single-binary-values.yaml
valuesFile: default-single-binary-values.yaml
extraArgs:
- --dependency-update
- --set

@ -0,0 +1,16 @@
---
loki:
commonConfig:
replication_factor: 1
useTestSchema: true
storage:
bucketNames:
chunks: chunks
ruler: ruler
admin: admin
read:
replicas: 1
write:
replicas: 1
backend:
replicas: 1

@ -0,0 +1,50 @@
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: HelmRepository
metadata:
name: grafana
namespace: default
spec:
interval: 1m
url: https://grafana.github.io/helm-charts
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: log-generator
namespace: default
spec:
interval: 1m
chart:
spec:
chart: alloy
sourceRef:
kind: HelmRepository
name: grafana
namespace: default
interval: 1m
values:
controller:
type: deployment
alloy:
configMap:
content: |
logging {
level = "debug"
write_to = [loki.relabel.default.receiver]
}
loki.relabel "default" {
rule {
target_label = "source"
replacement = "log-generator"
}
forward_to = [loki.write.default.receiver]
}
loki.write "default" {
endpoint {
url = "http://loki-gateway.loki.svc/loki/api/v1/push"
tenant_id = "1"
}
}

@ -0,0 +1,92 @@
---
apiVersion: helm-chart-toolbox.grafana.com/v1
kind: TestPlan
name: ssd
subject:
releaseName: loki
namespace: loki
path: ../../..
valuesFile: default-values.yaml
extraArgs:
- --dependency-update
- --set
- "chunksCache.allocatedMemory=1024"
cluster:
type: kind
dependencies:
- file: log-generator.yaml
- preset: grafana
overrides:
datasources:
datasources.yaml:
apiVersion: 1
datasources:
- name: Loki
type: loki
url: http://loki.loki.svc:3100/
isDefault: true
jsonData:
httpHeaderName1: X-Scope-OrgID
secureJsonData:
httpHeaderValue1: "1"
tests:
- type: kubernetes-objects-test
values:
checks:
- kind: StatefulSet
name: loki-backend
namespace: loki
- kind: StatefulSet
name: loki-write
namespace: loki
- kind: StatefulSet
name: loki-chunks-cache
namespace: loki
- kind: StatefulSet
name: loki-results-cache
namespace: loki
- kind: Deployment
name: loki-read
namespace: loki
- kind: Deployment
name: loki-gateway
namespace: loki
# Loki services
- kind: Service
name: loki-backend
namespace: loki
- kind: Service
name: loki-read
namespace: loki
- kind: Service
name: loki-write
namespace: loki
- kind: Service
name: loki-canary
namespace: loki
- kind: Service
name: loki-chunks-cache
namespace: loki
- kind: Service
name: loki-gateway
namespace: loki
- kind: Service
name: loki-memberlist
namespace: loki
- kind: Service
name: loki-results-cache
namespace: loki
- type: query-test
values:
tests:
- env:
LOKI_URL: http://loki-gateway.loki.svc/loki/api/v1/query
LOKI_TENANTID: 1
queries:
- query: count_over_time({source="log-generator"}[1h])
type: logql
Loading…
Cancel
Save