mirror of
https://github.com/actions/actions-runner-controller.git
synced 2026-01-17 01:04:47 +08:00
add more fields and tests
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
suite: "Test AutoscalingRunnerSet Annotations"
|
||||
templates:
|
||||
- autoscalingrunnserset.yaml
|
||||
tests:
|
||||
- it: should render values-hash annotation
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- exists:
|
||||
path: metadata.annotations["actions.github.com/values-hash"]
|
||||
|
||||
- it: should merge global and resource annotations (resource overrides global)
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
resource:
|
||||
all:
|
||||
metadata:
|
||||
annotations:
|
||||
a: "global"
|
||||
shared: "global"
|
||||
autoscalingRunnerSet:
|
||||
metadata:
|
||||
annotations:
|
||||
b: "resource"
|
||||
shared: "resource"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations.a
|
||||
value: "global"
|
||||
- equal:
|
||||
path: metadata.annotations.b
|
||||
value: "resource"
|
||||
- equal:
|
||||
path: metadata.annotations.shared
|
||||
value: "resource"
|
||||
|
||||
- it: should not allow overriding reserved values-hash annotation
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
resource:
|
||||
all:
|
||||
metadata:
|
||||
annotations:
|
||||
actions.github.com/values-hash: "user-value"
|
||||
ok: "ok"
|
||||
autoscalingRunnerSet:
|
||||
metadata:
|
||||
annotations:
|
||||
actions.github.com/cleanup-something: "should-not-render"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.annotations.ok
|
||||
value: "ok"
|
||||
- notEqual:
|
||||
path: metadata.annotations["actions.github.com/values-hash"]
|
||||
value: "user-value"
|
||||
- notExists:
|
||||
path: metadata.annotations["actions.github.com/cleanup-something"]
|
||||
@@ -0,0 +1,55 @@
|
||||
suite: "Test AutoscalingRunnerSet Listener Metrics"
|
||||
templates:
|
||||
- autoscalingrunnserset.yaml
|
||||
tests:
|
||||
- it: should not render listenerMetrics when not configured
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- notExists:
|
||||
path: spec.listenerMetrics
|
||||
|
||||
- it: should render listenerMetrics when configured
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
listenerMetrics:
|
||||
counters:
|
||||
gha_started_jobs_total:
|
||||
labels:
|
||||
- repository
|
||||
- organization
|
||||
histograms:
|
||||
gha_job_startup_duration_seconds:
|
||||
buckets:
|
||||
- 0.1
|
||||
- 1
|
||||
- 2.5
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- exists:
|
||||
path: spec.listenerMetrics
|
||||
- equal:
|
||||
path: spec.listenerMetrics.counters.gha_started_jobs_total.labels[0]
|
||||
value: repository
|
||||
- equal:
|
||||
path: spec.listenerMetrics.counters.gha_started_jobs_total.labels[1]
|
||||
value: organization
|
||||
- contains:
|
||||
path: spec.listenerMetrics.histograms.gha_job_startup_duration_seconds.buckets
|
||||
content: 0.1
|
||||
- contains:
|
||||
path: spec.listenerMetrics.histograms.gha_job_startup_duration_seconds.buckets
|
||||
content: 2.5
|
||||
@@ -0,0 +1,110 @@
|
||||
suite: "Test AutoscalingRunnerSet Vault Config"
|
||||
templates:
|
||||
- autoscalingrunnserset.yaml
|
||||
tests:
|
||||
- it: should not render vaultConfig when secretResolution.type is kubernetes
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
secretResolution:
|
||||
type: kubernetes
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- notExists:
|
||||
path: spec.vaultConfig
|
||||
|
||||
- it: should render azureKeyVault vaultConfig when configured
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
secretResolution:
|
||||
type: azureKeyVault
|
||||
azureKeyVault:
|
||||
url: "https://myvault.vault.azure.net"
|
||||
tenantId: "tenant-123"
|
||||
clientId: "client-456"
|
||||
certificatePath: "/etc/certs/akv.pem"
|
||||
secretKey: "secret-key-name"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.vaultConfig.type
|
||||
value: azureKeyVault
|
||||
- equal:
|
||||
path: spec.vaultConfig.azureKeyVault.url
|
||||
value: "https://myvault.vault.azure.net"
|
||||
- equal:
|
||||
path: spec.vaultConfig.azureKeyVault.tenantId
|
||||
value: "tenant-123"
|
||||
- equal:
|
||||
path: spec.vaultConfig.azureKeyVault.clientId
|
||||
value: "client-456"
|
||||
- equal:
|
||||
path: spec.vaultConfig.azureKeyVault.certificatePath
|
||||
value: "/etc/certs/akv.pem"
|
||||
- equal:
|
||||
path: spec.vaultConfig.azureKeyVault.secretKey
|
||||
value: "secret-key-name"
|
||||
|
||||
- it: should render vaultConfig proxy when configured
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
secretResolution:
|
||||
type: azureKeyVault
|
||||
proxy:
|
||||
http:
|
||||
url: "http://proxy.example.com:3128"
|
||||
credentialSecretRef: "proxy-credentials"
|
||||
noProxy:
|
||||
- "localhost"
|
||||
azureKeyVault:
|
||||
url: "https://myvault.vault.azure.net"
|
||||
tenantId: "tenant-123"
|
||||
clientId: "client-456"
|
||||
certificatePath: "/etc/certs/akv.pem"
|
||||
secretKey: "secret-key-name"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.vaultConfig.proxy.http.url
|
||||
value: "http://proxy.example.com:3128"
|
||||
- equal:
|
||||
path: spec.vaultConfig.proxy.http.credentialSecretRef
|
||||
value: "proxy-credentials"
|
||||
- contains:
|
||||
path: spec.vaultConfig.proxy.noProxy
|
||||
content: "localhost"
|
||||
- notExists:
|
||||
path: spec.proxy
|
||||
|
||||
- it: should fail for unsupported secretResolution.type
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
secretResolution:
|
||||
type: "hashicorpVault"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: "Unsupported keyVault type: hashicorpVault"
|
||||
Reference in New Issue
Block a user