Skip to content

Commit ebc81cc

Browse files
actions-userbschwedler
authored andcommitted
Update helm-docs and README.md
1 parent 50bc072 commit ebc81cc

File tree

1 file changed

+88
-64
lines changed

1 file changed

+88
-64
lines changed
Lines changed: 88 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,91 @@
1-
# rstudio-library-test
2-
3-
Test harness chart for unit testing the `rstudio-library` Helm library chart.
4-
5-
## Overview
6-
7-
Helm library charts cannot be installed or tested directly because they only define template functions. This test harness chart depends on `rstudio-library` and creates test templates that exercise all library functions, enabling comprehensive unit testing with [helm-unittest](https://github.com/helm-unittest/helm-unittest).
8-
9-
## Prerequisites
10-
11-
- Helm 3.x
12-
- helm-unittest plugin: `helm plugin install https://github.com/helm-unittest/helm-unittest.git`
13-
14-
## Running Tests
15-
16-
```bash
17-
# Update dependencies first
18-
helm dependency update other-charts/rstudio-library-test
19-
20-
# Run all tests
21-
helm unittest other-charts/rstudio-library-test
22-
```
23-
24-
## Test Coverage
251

26-
The test suite covers all `rstudio-library` template functions:
272

28-
| Test File | Library Templates Tested |
29-
|-----------|-------------------------|
30-
| `config_test.yaml` | `config.gcfg`, `config.ini`, `config.dcf`, `config.json`, `config.txt` |
31-
| `ingress_test.yaml` | `ingress.apiVersion`, `ingress.path`, `ingress.backend`, `ingress.supportsIngressClassName`, `ingress.supportsPathType` |
32-
| `license_test.yaml` | `license-env`, `license-mount`, `license-volume`, `license-secret` |
33-
| `rbac_test.yaml` | `rbac` (ServiceAccount, Role, RoleBinding, ClusterRole) |
34-
| `profiles_test.yaml` | `profiles.ini`, `profiles.ini.singleFile`, `profiles.ini.collapse-array`, `profiles.ini.advanced`, `profiles.json-from-overrides-config`, `profiles.apply-everyone-and-default-to-others` |
35-
| `debug_test.yaml` | `debug.type-check` |
36-
| `launcher_templates_test.yaml` | `templates.skeleton`, `templates.dataOutput`, `templates.dataOutputPretty` |
37-
| `tplvalues_test.yaml` | `tplvalues.render` |
38-
| `chronicle_agent_test.yaml` | `chronicle-agent.image`, `chronicle-agent.serverAddress` |
39-
40-
## Test Structure
41-
42-
Each test file follows this pattern:
43-
1. Includes the base values file (`tests/_base_values.yaml`) which nullifies all test categories
44-
2. Overrides only the specific test values needed for that test
45-
3. Uses assertions to verify expected output
46-
47-
The `_base_values.yaml` file provides test isolation by setting all test categories to `null`, preventing unrelated templates from rendering during tests.
48-
49-
## Adding New Tests
50-
51-
When adding tests for new `rstudio-library` templates:
52-
53-
1. Create a test template in `templates/test-*.yaml` that invokes the library template
54-
2. Add test values to `values.yaml` with documentation comments
55-
3. Update `tests/_base_values.yaml` to include the new test category (set to `null`)
56-
4. Create a test file in `tests/*_test.yaml` that includes `_base_values.yaml` and overrides only needed values
57-
58-
## Manual Verification
59-
60-
To manually verify template output:
61-
62-
```bash
63-
helm template test-release other-charts/rstudio-library-test
3+
# rstudio-library-test
644

65-
# Test specific template
66-
helm template test-release other-charts/rstudio-library-test -s templates/test-config.yaml
67-
```
5+
![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.0](https://img.shields.io/badge/AppVersion-0.1.0-informational?style=flat-square)
6+
7+
Test harness for rstudio-library templates
8+
9+
## Requirements
10+
11+
| Repository | Name | Version |
12+
|------------|------|---------|
13+
| file://../../charts/rstudio-library | rstudio-library | 0.1.35 |
14+
15+
## Values
16+
17+
| Key | Type | Default | Description |
18+
|-----|------|---------|-------------|
19+
| testChronicle.enabled | bool | `true` | |
20+
| testChronicle.image.registry | string | `"ghcr.io"` | |
21+
| testChronicle.image.repository | string | `"rstudio/chronicle-agent"` | |
22+
| testChronicle.image.tag | string | `"1.0.0"` | |
23+
| testChronicle.serverAddress | string | `"http://chronicle-server.default:8080"` | |
24+
| testChronicle.serverNamespace | string | `""` | |
25+
| testConfig.dcf.config.key1 | string | `"value1"` | |
26+
| testConfig.dcf.config.nested.subkey | string | `"subvalue"` | |
27+
| testConfig.dcf.filename | string | `"test.dcf"` | |
28+
| testConfig.gcfg.config.section1.key1 | string | `"value1"` | |
29+
| testConfig.gcfg.config.section1.key2 | string | `"value2"` | |
30+
| testConfig.gcfg.config.section2.arrayKey[0] | string | `"item1"` | |
31+
| testConfig.gcfg.config.section2.arrayKey[1] | string | `"item2"` | |
32+
| testConfig.gcfg.filename | string | `"test.gcfg"` | |
33+
| testConfig.ini.config.section1.key1 | string | `"value1"` | |
34+
| testConfig.ini.config.section1.key2 | int | `123` | |
35+
| testConfig.ini.filename | string | `"test.ini"` | |
36+
| testConfig.json.config.arrayKey[0] | string | `"item1"` | |
37+
| testConfig.json.config.arrayKey[1] | string | `"item2"` | |
38+
| testConfig.json.config.boolKey | bool | `true` | |
39+
| testConfig.json.config.numberKey | int | `42` | |
40+
| testConfig.json.config.stringKey | string | `"stringValue"` | |
41+
| testConfig.json.filename | string | `"test.json"` | |
42+
| testConfig.txt.config.key1 | string | `"value1"` | |
43+
| testConfig.txt.config.key2 | string | `"value2"` | |
44+
| testConfig.txt.filename | string | `"test.txt"` | |
45+
| testDebug.boolValue | bool | `true` | |
46+
| testDebug.mapValue.key | string | `"value"` | |
47+
| testDebug.sliceValue[0] | string | `"item1"` | |
48+
| testDebug.sliceValue[1] | string | `"item2"` | |
49+
| testDebug.stringValue | string | `"test string"` | |
50+
| testIngress.path | string | `"/test"` | |
51+
| testIngress.pathType | string | `"Prefix"` | |
52+
| testIngress.serviceName | string | `"test-service"` | |
53+
| testIngress.servicePort | int | `8080` | |
54+
| testLauncherTemplates.content.key1 | string | `"value1"` | |
55+
| testLauncherTemplates.content.key2 | string | `"value2"` | |
56+
| testLauncherTemplates.content.nested.subkey | string | `"subvalue"` | |
57+
| testLauncherTemplates.templateName | string | `"test-template"` | |
58+
| testLicense.licenseFile | string | `"LICENSE CONTENT HERE\n"` | |
59+
| testLicense.licenseKey | string | `"test-license-key"` | |
60+
| testLicense.licenseServer | string | `"license.example.com"` | |
61+
| testProfiles.advanced.data."launcher.kubernetes.profiles.conf".*.default-cpus | int | `1` | |
62+
| testProfiles.advanced.data."launcher.kubernetes.profiles.conf".testuser.default-cpus | int | `4` | |
63+
| testProfiles.advanced.filePath | string | `"/etc/rstudio/"` | |
64+
| testProfiles.advanced.jobJsonDefaults | list | `[]` | |
65+
| testProfiles.basicIni."launcher.kubernetes.profiles.conf".*.default-cpus | int | `1` | |
66+
| testProfiles.basicIni."launcher.kubernetes.profiles.conf".*.default-mem-mb | int | `512` | |
67+
| testProfiles.basicIni."launcher.kubernetes.profiles.conf".testuser.default-cpus | int | `2` | |
68+
| testProfiles.collapseArray.simple[0] | string | `"one"` | |
69+
| testProfiles.collapseArray.simple[1] | string | `"two"` | |
70+
| testProfiles.collapseArray.simple[2] | string | `"three"` | |
71+
| testProfiles.collapseArray.targetFile[0].file | string | `"/etc/config/pods.json"` | |
72+
| testProfiles.collapseArray.targetFile[0].target | string | `"pods"` | |
73+
| testProfiles.collapseArray.targetFile[1].file | string | `"/etc/config/services.json"` | |
74+
| testProfiles.collapseArray.targetFile[1].target | string | `"services"` | |
75+
| testProfiles.singleFile.*.job-name | string | `"default-job"` | |
76+
| testProfiles.singleFile.testuser.job-name | string | `"user-job"` | |
77+
| testRbac.annotations | object | `{}` | |
78+
| testRbac.clusterRoleCreate | bool | `false` | |
79+
| testRbac.labels | object | `{}` | |
80+
| testRbac.namespace | string | `"test-namespace"` | |
81+
| testRbac.removeNamespaceReferences | bool | `false` | |
82+
| testRbac.serviceAccountCreate | bool | `true` | |
83+
| testRbac.serviceAccountName | string | `"test-sa"` | |
84+
| testRbac.targetNamespace | string | `"test-target"` | |
85+
| testTplvalues.objectValue.name | string | `"{{ .Release.Name }}"` | |
86+
| testTplvalues.objectValue.namespace | string | `"{{ .Release.Namespace }}"` | |
87+
| testTplvalues.staticValue | string | `"static"` | |
88+
| testTplvalues.templateValue | string | `"{{ .Release.Name }}-suffix"` | |
89+
90+
----------------------------------------------
91+
Autogenerated from chart metadata using [helm-docs v1.13.1](https://github.com/norwoodj/helm-docs/releases/v1.13.1)

0 commit comments

Comments
 (0)