From 84c82b4d4e38929f9dbd4e862af28152297db254 Mon Sep 17 00:00:00 2001 From: Nick Volynkin Date: Tue, 29 Jul 2025 18:07:10 +0300 Subject: [PATCH 1/2] [test] Add test cases for types and combinations in values.yaml Signed-off-by: Nick Volynkin --- examples/virtual-machine.yaml | 2 +- test/basic-types/Makefile | 1 + test/basic-types/README.md | 42 +++++++++++++ test/basic-types/values.schema.json | 78 +++++++++++++++++++++++ test/basic-types/values.yaml | 40 ++++++++++++ test/complex-types/Makefile | 1 + test/complex-types/README.md | 29 +++++++++ test/complex-types/values.schema.json | 86 +++++++++++++++++++++++++ test/complex-types/values.yaml | 41 ++++++++++++ test/fields/Makefile | 1 + test/fields/README.md | 17 +++++ test/fields/values.schema.json | 51 +++++++++++++++ test/fields/values.yaml | 20 ++++++ test/lists/Makefile | 1 + test/lists/README.md | 27 ++++++++ test/lists/values.schema.json | 90 +++++++++++++++++++++++++++ test/lists/values.yaml | 51 +++++++++++++++ test/template/Makefile | 1 + test/template/README.md | 10 +++ test/template/values.schema.json | 9 +++ test/template/values.yaml | 4 ++ test/test.mk | 9 +++ 22 files changed, 610 insertions(+), 1 deletion(-) create mode 100644 test/basic-types/Makefile create mode 100644 test/basic-types/README.md create mode 100644 test/basic-types/values.schema.json create mode 100644 test/basic-types/values.yaml create mode 100644 test/complex-types/Makefile create mode 100644 test/complex-types/README.md create mode 100644 test/complex-types/values.schema.json create mode 100644 test/complex-types/values.yaml create mode 100644 test/fields/Makefile create mode 100644 test/fields/README.md create mode 100644 test/fields/values.schema.json create mode 100644 test/fields/values.yaml create mode 100644 test/lists/Makefile create mode 100644 test/lists/README.md create mode 100644 test/lists/values.schema.json create mode 100644 test/lists/values.yaml create mode 100644 test/template/Makefile create mode 100644 test/template/README.md create mode 100644 test/template/values.schema.json create mode 100644 test/template/values.yaml create mode 100644 test/test.mk diff --git a/examples/virtual-machine.yaml b/examples/virtual-machine.yaml index 0a05d43..13e9c38 100644 --- a/examples/virtual-machine.yaml +++ b/examples/virtual-machine.yaml @@ -8,7 +8,7 @@ external: false externalMethod: PortList externalPorts: -- 22 + - 22 ## @param running {bool} if the virtual machine should be running running: true diff --git a/test/basic-types/Makefile b/test/basic-types/Makefile new file mode 100644 index 0000000..92bdef8 --- /dev/null +++ b/test/basic-types/Makefile @@ -0,0 +1 @@ +include ../test.mk \ No newline at end of file diff --git a/test/basic-types/README.md b/test/basic-types/README.md new file mode 100644 index 0000000..818748f --- /dev/null +++ b/test/basic-types/README.md @@ -0,0 +1,42 @@ +## Case Description + +Test cases for basic types: + +- `int` +- `bool` +- `string` + +All types are checked in required and nullable variations. + +## Parameters + +### Integer parameters + +| Name | Description | Type | Value | +| ------------------------ | --------------------------------------------- | ------ | ------ | +| `testInt` | Integer variable | `int` | `null` | +| `testIntDefault` | Integer variable with default value | `int` | `10` | +| `testIntNullable` | Integer variable, nullable | `*int` | `null` | +| `testIntDefaultNullable` | Integer variable with default value, nullable | `*int` | `10` | + +### Boolean parameters + +| Name | Description | Type | Value | +| ----------------------- | --------------------------------------------- | ------- | ------- | +| `testBool` | Boolean variable | `bool` | `null` | +| `testBoolFalse` | Boolean variable, defaults to false | `bool` | `false` | +| `testBoolTrue` | Boolean variable, defaults to true | `bool` | `true` | +| `testBoolNullable` | Boolean variable, nullable | `*bool` | `null` | +| `testBoolFalseNullable` | Boolean variable, defaults to false, nullable | `*bool` | `false` | +| `testBoolTrueNullable` | Boolean variable, defaults to true, nullable | `*bool` | `true` | + +### String parameters + +| Name | Description | Type | Value | +| --------------------------- | -------------------------------------------- | --------- | -------------- | +| `testString` | String variable | `string` | `null` | +| `testStringEmpty` | String variable, empty by default | `string` | `` | +| `testStringDefault` | String variable with default value | `string` | `string value` | +| `testStringNullable` | String variable, nullable | `*string` | `null` | +| `testStringEmptyNullable` | String variable, empty by default, nullable | `*string` | `` | +| `testStringDefaultNullable` | String variable with default value, nullable | `*string` | `string value` | diff --git a/test/basic-types/values.schema.json b/test/basic-types/values.schema.json new file mode 100644 index 0000000..0d61da0 --- /dev/null +++ b/test/basic-types/values.schema.json @@ -0,0 +1,78 @@ +{ + "title": "Chart Values", + "type": "object", + "properties": { + "testBool": { + "description": "Boolean variable", + "type": "boolean" + }, + "testBoolFalse": { + "description": "Boolean variable, defaults to false", + "type": "boolean", + "default": false + }, + "testBoolFalseNullable": { + "description": "Boolean variable, defaults to false, nullable", + "type": "boolean", + "default": false + }, + "testBoolNullable": { + "description": "Boolean variable, nullable", + "type": "boolean" + }, + "testBoolTrue": { + "description": "Boolean variable, defaults to true", + "type": "boolean", + "default": true + }, + "testBoolTrueNullable": { + "description": "Boolean variable, defaults to true, nullable", + "type": "boolean", + "default": true + }, + "testInt": { + "description": "Integer variable", + "type": "integer" + }, + "testIntDefault": { + "description": "Integer variable with default value", + "type": "integer", + "default": 10 + }, + "testIntDefaultNullable": { + "description": "Integer variable with default value, nullable", + "type": "integer", + "default": 10 + }, + "testIntNullable": { + "description": "Integer variable, nullable", + "type": "integer" + }, + "testString": { + "description": "String variable", + "type": "string" + }, + "testStringDefault": { + "description": "String variable with default value", + "type": "string", + "default": "string value" + }, + "testStringDefaultNullable": { + "description": "String variable with default value, nullable", + "type": "string", + "default": "string value" + }, + "testStringEmpty": { + "description": "String variable, empty by default", + "type": "string" + }, + "testStringEmptyNullable": { + "description": "String variable, empty by default, nullable", + "type": "string" + }, + "testStringNullable": { + "description": "String variable, nullable", + "type": "string" + } + } +} \ No newline at end of file diff --git a/test/basic-types/values.yaml b/test/basic-types/values.yaml new file mode 100644 index 0000000..9bc5906 --- /dev/null +++ b/test/basic-types/values.yaml @@ -0,0 +1,40 @@ +## @section Integer parameters + +## @param testInt {int} Integer variable +testInt: +## @param testIntDefault {int} Integer variable with default value +testIntDefault: 10 +## @param testIntNullable {*int} Integer variable, nullable +testIntNullable: +## @param testIntDefaultNullable {*int} Integer variable with default value, nullable +testIntDefaultNullable: 10 + +## @section Boolean parameters + +## @param testBool {bool} Boolean variable +testBool: +## @param testBoolFalse {bool} Boolean variable, defaults to false +testBoolFalse: false +## @param testBoolTrue {bool} Boolean variable, defaults to true +testBoolTrue: true +## @param testBoolNullable {*bool} Boolean variable, nullable +testBoolNullable: +## @param testBoolFalseNullable {*bool} Boolean variable, defaults to false, nullable +testBoolFalseNullable: false +## @param testBoolTrueNullable {*bool} Boolean variable, defaults to true, nullable +testBoolTrueNullable: true + +## @section String parameters + +## @param testString {string} String variable +testString: +## @param testStringEmpty {string} String variable, empty by default +testStringEmpty: "" +## @param testStringDefault {string} String variable with default value +testStringDefault: "string value" +## @param testStringNullable {*string} String variable, nullable +testStringNullable: +## @param testStringEmptyNullable {*string} String variable, empty by default, nullable +testStringEmptyNullable: "" +## @param testStringDefaultNullable {*string} String variable with default value, nullable +testStringDefaultNullable: "string value" diff --git a/test/complex-types/Makefile b/test/complex-types/Makefile new file mode 100644 index 0000000..92bdef8 --- /dev/null +++ b/test/complex-types/Makefile @@ -0,0 +1 @@ +include ../test.mk \ No newline at end of file diff --git a/test/complex-types/README.md b/test/complex-types/README.md new file mode 100644 index 0000000..83ca937 --- /dev/null +++ b/test/complex-types/README.md @@ -0,0 +1,29 @@ +## Case Description + +Tests for complex types, extending base ones. + +- `quantity` — measure of CPU cores and memory. + +## Parameters + +### Quantity parameters + +| Name | Description | Type | Value | +| ------------------------- | --------------------------------------------------------------- | ---------- | -------- | +| `quantityRequired` | A required quantity value (CPU cores or RAM). | `quantity` | `null` | +| `quantityRequiredEmpty` | A required quantity value with empty string (CPU cores or RAM). | `quantity` | `` | +| `quantityDefaultInt` | A quantity default with a bare integer. | `quantity` | `2` | +| `quantityDefaultStrInt` | A quantity default with a quoted integer. | `quantity` | `2` | +| `quantityDefaultCpuShare` | A quantity default with vCPU share. | `quantity` | `100m` | +| `quantityDefaultRam` | A quantity default with RAM size. | `quantity` | `500MiB` | + +### Nullable quantity parameters + +| Name | Description | Type | Value | +| --------------------------------- | --------------------------------------------------------------- | ----------- | -------- | +| `quantityNullable` | A nullable quantity value. | `*quantity` | `null` | +| `quantityNullableRequiredEmpty` | A nullable quantity value with empty string (CPU cores or RAM). | `*quantity` | `` | +| `quantityNullableDefaultInt` | A nullable quantity with a default bare integer. | `*quantity` | `2` | +| `quantityNullableDefaultStrInt` | A nullable quantity with a default quoted integer. | `*quantity` | `2` | +| `quantityNullableDefaultCpuShare` | A nullable quantity with a default CPU share. | `*quantity` | `100m` | +| `quantityNullableDefaultRam` | A nullable quantity with a default RAM size. | `*quantity` | `500MiB` | diff --git a/test/complex-types/values.schema.json b/test/complex-types/values.schema.json new file mode 100644 index 0000000..e0245ec --- /dev/null +++ b/test/complex-types/values.schema.json @@ -0,0 +1,86 @@ +{ + "title": "Chart Values", + "type": "object", + "properties": { + "quantityDefaultCpuShare": { + "description": "A quantity default with vCPU share.", + "type": "string", + "default": "100m", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "x-kubernetes-int-or-string": true + }, + "quantityDefaultInt": { + "description": "A quantity default with a bare integer.", + "type": "string", + "default": "2", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "x-kubernetes-int-or-string": true + }, + "quantityDefaultRam": { + "description": "A quantity default with RAM size.", + "type": "string", + "default": "500MiB", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "x-kubernetes-int-or-string": true + }, + "quantityDefaultStrInt": { + "description": "A quantity default with a quoted integer.", + "type": "string", + "default": "2", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "x-kubernetes-int-or-string": true + }, + "quantityNullable": { + "description": "A nullable quantity value.", + "type": "string", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "x-kubernetes-int-or-string": true + }, + "quantityNullableDefaultCpuShare": { + "description": "A nullable quantity with a default CPU share.", + "type": "string", + "default": "100m", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "x-kubernetes-int-or-string": true + }, + "quantityNullableDefaultInt": { + "description": "A nullable quantity with a default bare integer.", + "type": "string", + "default": "2", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "x-kubernetes-int-or-string": true + }, + "quantityNullableDefaultRam": { + "description": "A nullable quantity with a default RAM size.", + "type": "string", + "default": "500MiB", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "x-kubernetes-int-or-string": true + }, + "quantityNullableDefaultStrInt": { + "description": "A nullable quantity with a default quoted integer.", + "type": "string", + "default": "2", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "x-kubernetes-int-or-string": true + }, + "quantityNullableRequiredEmpty": { + "description": "A nullable quantity value with empty string (CPU cores or RAM).", + "type": "string", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "x-kubernetes-int-or-string": true + }, + "quantityRequired": { + "description": "A required quantity value (CPU cores or RAM).", + "type": "string", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "x-kubernetes-int-or-string": true + }, + "quantityRequiredEmpty": { + "description": "A required quantity value with empty string (CPU cores or RAM).", + "type": "string", + "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$", + "x-kubernetes-int-or-string": true + } + } +} \ No newline at end of file diff --git a/test/complex-types/values.yaml b/test/complex-types/values.yaml new file mode 100644 index 0000000..b265d7b --- /dev/null +++ b/test/complex-types/values.yaml @@ -0,0 +1,41 @@ +## @section Quantity parameters + +## @param quantityRequired {quantity} A required quantity value (CPU cores or RAM). +quantityRequired: + +## @param quantityRequiredEmpty {quantity} A required quantity value with empty string (CPU cores or RAM). +quantityRequiredEmpty: "" + +## @param quantityDefaultInt {quantity} A quantity default with a bare integer. +quantityDefaultInt: 2 + +## @param quantityDefaultStrInt {quantity} A quantity default with a quoted integer. +quantityDefaultStrInt: "2" + +## @param quantityDefaultCpuShare {quantity} A quantity default with vCPU share. +quantityDefaultCpuShare: "100m" + +## @param quantityDefaultRam {quantity} A quantity default with RAM size. +quantityDefaultRam: "500MiB" + + +## @section Nullable quantity parameters + +## @param quantityNullable {*quantity} A nullable quantity value. +quantityNullable: + +## @param quantityNullableRequiredEmpty {*quantity} A nullable quantity value with empty string (CPU cores or RAM). +quantityNullableRequiredEmpty: "" + +## @param quantityNullableDefaultInt {*quantity} A nullable quantity with a default bare integer. +quantityNullableDefaultInt: 2 + +## @param quantityNullableDefaultStrInt {*quantity} A nullable quantity with a default quoted integer. +quantityNullableDefaultStrInt: "2" + +## @param quantityNullableDefaultCpuShare {*quantity} A nullable quantity with a default CPU share. +quantityNullableDefaultCpuShare: "100m" + +## @param quantityNullableDefaultRam {*quantity} A nullable quantity with a default RAM size. +quantityNullableDefaultRam: "500MiB" + diff --git a/test/fields/Makefile b/test/fields/Makefile new file mode 100644 index 0000000..92bdef8 --- /dev/null +++ b/test/fields/Makefile @@ -0,0 +1 @@ +include ../test.mk \ No newline at end of file diff --git a/test/fields/README.md b/test/fields/README.md new file mode 100644 index 0000000..8349e4e --- /dev/null +++ b/test/fields/README.md @@ -0,0 +1,17 @@ +## Case Description + +Test case for complex object with `field`s declared inside them. + +## Parameters + +### Complex Object tests + +| Name | Description | Type | Value | +| --------------- | ---------------------------------------------------- | -------- | ------ | +| `foo` | Configuration for foo | `object` | `null` | +| `foo.db` | Field with custom type declared locally | `object` | | +| `foo.db.size` | Sub-field declared with path relative to custom type | `string` | | +| `bar` | Configuration for bar | `object` | `null` | +| `bar.db` | Field with custom type declared locally | `object` | | +| `bar.db.size` | Sub-field declared with path relative to custom type | `string` | | +| `bar.db.volume` | Sub-field declared with absolute path | `string` | | diff --git a/test/fields/values.schema.json b/test/fields/values.schema.json new file mode 100644 index 0000000..5393e90 --- /dev/null +++ b/test/fields/values.schema.json @@ -0,0 +1,51 @@ +{ + "title": "Chart Values", + "type": "object", + "properties": { + "bar": { + "description": "Configuration for bar", + "type": "object", + "required": [ + "db" + ], + "properties": { + "db": { + "description": "Field with custom type declared locally", + "type": "object", + "required": [ + "size" + ], + "properties": { + "size": { + "description": "Sub-field declared with path relative to custom type", + "type": "string" + } + } + } + } + }, + "foo": { + "description": "Configuration for foo", + "type": "object", + "required": [ + "db" + ], + "properties": { + "db": { + "description": "Field with custom type declared locally", + "type": "object", + "required": [ + "size" + ], + "properties": { + "size": { + "description": "Sub-field declared with path relative to custom type", + "type": "string", + "default": "10Gi" + } + } + } + } + } + } +} \ No newline at end of file diff --git a/test/fields/values.yaml b/test/fields/values.yaml new file mode 100644 index 0000000..dd28db5 --- /dev/null +++ b/test/fields/values.yaml @@ -0,0 +1,20 @@ +## @section Complex Object tests + +## @param foo {foo} Configuration for foo +## @field foo.db {fooDB} Field with custom type declared locally +## @field fooDB.size {string} Sub-field declared with path relative to custom type + +foo: + db: + size: 10Gi + +## @param bar {bar} Configuration for bar +## @field bar.db {barDB} Field with custom type declared locally +## @field barDB.size {string} Sub-field declared with path relative to custom type +## @field bar.db.volume {string} Sub-field declared with absolute path + +bar: + db: + size: 10Gi + volume: 10Gi + diff --git a/test/lists/Makefile b/test/lists/Makefile new file mode 100644 index 0000000..92bdef8 --- /dev/null +++ b/test/lists/Makefile @@ -0,0 +1 @@ +include ../test.mk \ No newline at end of file diff --git a/test/lists/README.md b/test/lists/README.md new file mode 100644 index 0000000..1f3f214 --- /dev/null +++ b/test/lists/README.md @@ -0,0 +1,27 @@ +## Case Description + +Cases for lists of `int`, `string`, and `object`. + +## Parameters + +### Integer lists + +| Name | Description | Type | Value | +| ------------------------- | ------------------------------------------------- | -------- | ------ | +| `intList` | A required list of integers, empty. | `[]int` | `null` | +| `intListSingle` | A list of integers with one value. | `[]int` | `null` | +| `intListMultiple` | A list of integers with one value. | `[]int` | `null` | +| `intListNullable` | A nullable list of integers, empty. | `[]*int` | `null` | +| `intListNullableSingle` | A nullable list of integers with one value. | `[]*int` | `null` | +| `intListNullableMultiple` | A nullable list of integers with multiple values. | `[]*int` | `null` | + +### String lists + +| Name | Description | Type | Value | +| ---------------------------- | ------------------------------------------------ | ----------- | ------ | +| `stringList` | A required list of strings, empty. | `[]string` | `null` | +| `stringListSingle` | A required list of strings with one value. | `[]string` | `null` | +| `stringListMultiple` | A required list of strings with multiple values. | `[]string` | `null` | +| `stringListNullable` | A nullable list of strings, empty. | `[]*string` | `null` | +| `stringListNullableSingle` | A nullable list of strings with one value. | `[]*string` | `null` | +| `stringListNullableMultiple` | A nullable list of strings with multiple values. | `[]*string` | `null` | diff --git a/test/lists/values.schema.json b/test/lists/values.schema.json new file mode 100644 index 0000000..faf0b42 --- /dev/null +++ b/test/lists/values.schema.json @@ -0,0 +1,90 @@ +{ + "title": "Chart Values", + "type": "object", + "properties": { + "intList": { + "description": "A required list of integers, empty.", + "type": "array", + "items": { + "type": "integer" + } + }, + "intListMultiple": { + "description": "A list of integers with one value.", + "type": "array", + "items": { + "type": "integer" + } + }, + "intListNullable": { + "description": "A nullable list of integers, empty.", + "type": "array", + "items": { + "type": "integer" + } + }, + "intListNullableMultiple": { + "description": "A nullable list of integers with multiple values.", + "type": "array", + "items": { + "type": "integer" + } + }, + "intListNullableSingle": { + "description": "A nullable list of integers with one value.", + "type": "array", + "items": { + "type": "integer" + } + }, + "intListSingle": { + "description": "A list of integers with one value.", + "type": "array", + "items": { + "type": "integer" + } + }, + "stringList": { + "description": "A required list of strings, empty.", + "type": "array", + "items": { + "type": "string" + } + }, + "stringListMultiple": { + "description": "A required list of strings with multiple values.", + "type": "array", + "items": { + "type": "string" + } + }, + "stringListNullable": { + "description": "A nullable list of strings, empty.", + "type": "array", + "items": { + "type": "string" + } + }, + "stringListNullableMultiple": { + "description": "A nullable list of strings with multiple values.", + "type": "array", + "items": { + "type": "string" + } + }, + "stringListNullableSingle": { + "description": "A nullable list of strings with one value.", + "type": "array", + "items": { + "type": "string" + } + }, + "stringListSingle": { + "description": "A required list of strings with one value.", + "type": "array", + "items": { + "type": "string" + } + } + } +} \ No newline at end of file diff --git a/test/lists/values.yaml b/test/lists/values.yaml new file mode 100644 index 0000000..73a2561 --- /dev/null +++ b/test/lists/values.yaml @@ -0,0 +1,51 @@ +## @section Integer lists + +## @param intList {[]int} A required list of integers, empty. +intList: + +## @param intListSingle {[]int} A list of integers with one value. +intListSingle: + - 80 + +## @param intListMultiple {[]int} A list of integers with one value. +intListMultiple: + - 80 + - 8080 + +## @param intListNullable {[]*int} A nullable list of integers, empty. +intListNullable: + +## @param intListNullableSingle {[]*int} A nullable list of integers with one value. +intListNullableSingle: + - 80 + +## @param intListNullableMultiple {[]*int} A nullable list of integers with multiple values. +intListNullableMultiple: + - 80 + - 8080 + +## @section String lists + +## @param stringList {[]string} A required list of strings, empty. +stringList: + +## @param stringListSingle {[]string} A required list of strings with one value. +stringListSingle: + - "user1" + +## @param stringListMultiple {[]string} A required list of strings with multiple values. +stringListMultiple: + - "user1" + - "user2" + +## @param stringListNullable {[]*string} A nullable list of strings, empty. +stringListNullable: + +## @param stringListNullableSingle {[]*string} A nullable list of strings with one value. +stringListNullableSingle: + - "user1" + +## @param stringListNullableMultiple {[]*string} A nullable list of strings with multiple values. +stringListNullableMultiple: + - "user1" + - "user2" \ No newline at end of file diff --git a/test/template/Makefile b/test/template/Makefile new file mode 100644 index 0000000..92bdef8 --- /dev/null +++ b/test/template/Makefile @@ -0,0 +1 @@ +include ../test.mk \ No newline at end of file diff --git a/test/template/README.md b/test/template/README.md new file mode 100644 index 0000000..8f0e6db --- /dev/null +++ b/test/template/README.md @@ -0,0 +1,10 @@ +## Case Description + + +## Parameters + +### Test configuration + +| Name | Description | Type | Value | +| ------ | ------------- | -------- | ------ | +| `test` | Test variable | `object` | `null` | diff --git a/test/template/values.schema.json b/test/template/values.schema.json new file mode 100644 index 0000000..80ae2a5 --- /dev/null +++ b/test/template/values.schema.json @@ -0,0 +1,9 @@ +{ + "title": "Chart Values", + "type": "object", + "properties": { + "test": { + "description": "Test variable" + } + } +} \ No newline at end of file diff --git a/test/template/values.yaml b/test/template/values.yaml new file mode 100644 index 0000000..cf2c326 --- /dev/null +++ b/test/template/values.yaml @@ -0,0 +1,4 @@ +## @section Test configuration + +## @param test {test} Test variable +test: \ No newline at end of file diff --git a/test/test.mk b/test/test.mk new file mode 100644 index 0000000..74fae43 --- /dev/null +++ b/test/test.mk @@ -0,0 +1,9 @@ +GENERATOR ?= cozyvalues-gen + +generate: + $(GENERATOR) -v values.yaml -s values.schema.json -r README.md + +test: generate + # check git diff, if empty, exit 0 + # if not empty, print outputs and exit 1 + @git diff --quiet || { git --no-pager diff; exit 1; } \ No newline at end of file From a88338c1c10c7184080e46044bb4ec9a9b05502e Mon Sep 17 00:00:00 2001 From: Nick Volynkin Date: Thu, 31 Jul 2025 08:57:53 +0300 Subject: [PATCH 2/2] [test] Updated results for v0.6.3 Signed-off-by: Nick Volynkin --- test/basic-types/Makefile | 2 +- test/basic-types/README.md | 15 ++-- test/complex-types/Makefile | 2 +- test/complex-types/README.md | 46 +++++++---- test/complex-types/values.schema.json | 34 ++++++++ test/complex-types/values.yaml | 17 ++++ test/fields/Makefile | 1 - test/fields/README.md | 17 ---- test/lists/Makefile | 2 +- test/lists/README.md | 60 ++++++++++---- test/lists/values.schema.json | 87 ++++++++++++++++++++- test/lists/values.yaml | 50 ++++++++++-- test/objects/Makefile | 1 + test/objects/README.md | 22 ++++++ test/{fields => objects}/values.schema.json | 39 ++++++++- test/{fields => objects}/values.yaml | 11 ++- test/template/Makefile | 2 +- test/template/README.md | 9 ++- test/template/values.schema.json | 3 +- 19 files changed, 340 insertions(+), 80 deletions(-) delete mode 100644 test/fields/Makefile delete mode 100644 test/fields/README.md create mode 100644 test/objects/Makefile create mode 100644 test/objects/README.md rename test/{fields => objects}/values.schema.json (54%) rename test/{fields => objects}/values.yaml (54%) diff --git a/test/basic-types/Makefile b/test/basic-types/Makefile index 92bdef8..32e9003 100644 --- a/test/basic-types/Makefile +++ b/test/basic-types/Makefile @@ -1 +1 @@ -include ../test.mk \ No newline at end of file +include ../test.mk diff --git a/test/basic-types/README.md b/test/basic-types/README.md index 818748f..b0962f7 100644 --- a/test/basic-types/README.md +++ b/test/basic-types/README.md @@ -9,34 +9,37 @@ Test cases for basic types: All types are checked in required and nullable variations. ## Parameters - ### Integer parameters | Name | Description | Type | Value | | ------------------------ | --------------------------------------------- | ------ | ------ | -| `testInt` | Integer variable | `int` | `null` | +| `testInt` | Integer variable | `int` | `0` | | `testIntDefault` | Integer variable with default value | `int` | `10` | | `testIntNullable` | Integer variable, nullable | `*int` | `null` | | `testIntDefaultNullable` | Integer variable with default value, nullable | `*int` | `10` | + ### Boolean parameters | Name | Description | Type | Value | | ----------------------- | --------------------------------------------- | ------- | ------- | -| `testBool` | Boolean variable | `bool` | `null` | +| `testBool` | Boolean variable | `bool` | `false` | | `testBoolFalse` | Boolean variable, defaults to false | `bool` | `false` | | `testBoolTrue` | Boolean variable, defaults to true | `bool` | `true` | | `testBoolNullable` | Boolean variable, nullable | `*bool` | `null` | | `testBoolFalseNullable` | Boolean variable, defaults to false, nullable | `*bool` | `false` | | `testBoolTrueNullable` | Boolean variable, defaults to true, nullable | `*bool` | `true` | + ### String parameters | Name | Description | Type | Value | | --------------------------- | -------------------------------------------- | --------- | -------------- | -| `testString` | String variable | `string` | `null` | -| `testStringEmpty` | String variable, empty by default | `string` | `` | +| `testString` | String variable | `string` | `""` | +| `testStringEmpty` | String variable, empty by default | `string` | `""` | | `testStringDefault` | String variable with default value | `string` | `string value` | | `testStringNullable` | String variable, nullable | `*string` | `null` | -| `testStringEmptyNullable` | String variable, empty by default, nullable | `*string` | `` | +| `testStringEmptyNullable` | String variable, empty by default, nullable | `*string` | `""` | | `testStringDefaultNullable` | String variable with default value, nullable | `*string` | `string value` | + + diff --git a/test/complex-types/Makefile b/test/complex-types/Makefile index 92bdef8..32e9003 100644 --- a/test/complex-types/Makefile +++ b/test/complex-types/Makefile @@ -1 +1 @@ -include ../test.mk \ No newline at end of file +include ../test.mk diff --git a/test/complex-types/README.md b/test/complex-types/README.md index 83ca937..564f84c 100644 --- a/test/complex-types/README.md +++ b/test/complex-types/README.md @@ -5,25 +5,37 @@ Tests for complex types, extending base ones. - `quantity` — measure of CPU cores and memory. ## Parameters - ### Quantity parameters -| Name | Description | Type | Value | -| ------------------------- | --------------------------------------------------------------- | ---------- | -------- | -| `quantityRequired` | A required quantity value (CPU cores or RAM). | `quantity` | `null` | -| `quantityRequiredEmpty` | A required quantity value with empty string (CPU cores or RAM). | `quantity` | `` | -| `quantityDefaultInt` | A quantity default with a bare integer. | `quantity` | `2` | -| `quantityDefaultStrInt` | A quantity default with a quoted integer. | `quantity` | `2` | -| `quantityDefaultCpuShare` | A quantity default with vCPU share. | `quantity` | `100m` | -| `quantityDefaultRam` | A quantity default with RAM size. | `quantity` | `500MiB` | +| Name | Description | Type | Value | +| ------------------------- | --------------------------------------------------------------- | -------- | -------- | +| `quantityRequired` | A required quantity value (CPU cores or RAM). | `string` | `""` | +| `quantityRequiredEmpty` | A required quantity value with empty string (CPU cores or RAM). | `string` | `""` | +| `quantityDefaultInt` | A quantity default with a bare integer. | `string` | `2` | +| `quantityDefaultStrInt` | A quantity default with a quoted integer. | `string` | `2` | +| `quantityDefaultCpuShare` | A quantity default with vCPU share. | `string` | `100m` | +| `quantityDefaultRam` | A quantity default with RAM size. | `string` | `500MiB` | + ### Nullable quantity parameters -| Name | Description | Type | Value | -| --------------------------------- | --------------------------------------------------------------- | ----------- | -------- | -| `quantityNullable` | A nullable quantity value. | `*quantity` | `null` | -| `quantityNullableRequiredEmpty` | A nullable quantity value with empty string (CPU cores or RAM). | `*quantity` | `` | -| `quantityNullableDefaultInt` | A nullable quantity with a default bare integer. | `*quantity` | `2` | -| `quantityNullableDefaultStrInt` | A nullable quantity with a default quoted integer. | `*quantity` | `2` | -| `quantityNullableDefaultCpuShare` | A nullable quantity with a default CPU share. | `*quantity` | `100m` | -| `quantityNullableDefaultRam` | A nullable quantity with a default RAM size. | `*quantity` | `500MiB` | +| Name | Description | Type | Value | +| --------------------------------- | --------------------------------------------------------------- | --------- | -------- | +| `quantityNullable` | A nullable quantity value. | `*string` | `null` | +| `quantityNullableRequiredEmpty` | A nullable quantity value with empty string (CPU cores or RAM). | `*string` | `""` | +| `quantityNullableDefaultInt` | A nullable quantity with a default bare integer. | `*string` | `2` | +| `quantityNullableDefaultStrInt` | A nullable quantity with a default quoted integer. | `*string` | `2` | +| `quantityNullableDefaultCpuShare` | A nullable quantity with a default CPU share. | `*string` | `100m` | +| `quantityNullableDefaultRam` | A nullable quantity with a default RAM size. | `*string` | `500MiB` | + + +### Enumerated parameters + +| Name | Description | Type | Value | +| ---------------------------------- | ------------------------------------ | -------- | ------- | +| `enumWithDefault` | Enum variable, defaults to "micro" | `string` | `{}` | +| `enumWithoutDefault` | Enum variable with no default value. | `string` | `{}` | +| `nested` | Element with nested enum fields | `object` | `{}` | +| `nested.enumWithCustomTypeDefault` | Enum variable, defaults to "micro" | `string` | `micro` | + + diff --git a/test/complex-types/values.schema.json b/test/complex-types/values.schema.json index e0245ec..c34349a 100644 --- a/test/complex-types/values.schema.json +++ b/test/complex-types/values.schema.json @@ -2,6 +2,40 @@ "title": "Chart Values", "type": "object", "properties": { + "enumWithDefault": { + "description": "Enum variable, defaults to \"micro\"", + "type": "string", + "default": "micro", + "enum": [ + "nano", + "micro", + "small", + "medium", + "large", + "xlarge", + "2xlarge" + ] + }, + "enumWithoutDefault": { + "description": "Enum variable with no default value.", + "type": "string", + "enum": [ + "nano", + "micro", + "small", + "medium", + "large", + "xlarge", + "2xlarge" + ] + }, + "nested": { + "description": "Element with nested enum fields", + "type": "object", + "default": { + "enumWithCustomTypeDefault": "micro" + } + }, "quantityDefaultCpuShare": { "description": "A quantity default with vCPU share.", "type": "string", diff --git a/test/complex-types/values.yaml b/test/complex-types/values.yaml index b265d7b..e3ab911 100644 --- a/test/complex-types/values.yaml +++ b/test/complex-types/values.yaml @@ -39,3 +39,20 @@ quantityNullableDefaultCpuShare: "100m" ## @param quantityNullableDefaultRam {*quantity} A nullable quantity with a default RAM size. quantityNullableDefaultRam: "500MiB" + +## @section Enumerated parameters + +## @param enumWithDefault {string enum:"nano,micro,small,medium,large,xlarge,2xlarge"} Enum variable, defaults to "micro" +enumWithDefault: "micro" + +## @param enumWithoutDefault {string enum:"nano,micro,small,medium,large,xlarge,2xlarge"} Enum variable with no default value. +enumWithoutDefault: + + +## @param nested {nested} Element with nested enum fields +nested: + ## @param nested.enumWithDefault {string enum:"nano,micro,small,medium,large,xlarge,2xlarge"} Enum variable, defaults to "micro" + enumWithDefault: "micro" + + ## @param nested.enumWithoutDefault {string enum:"nano,micro,small,medium,large,xlarge,2xlarge"} Enum variable with no default value. + enumWithoutDefault: diff --git a/test/fields/Makefile b/test/fields/Makefile deleted file mode 100644 index 92bdef8..0000000 --- a/test/fields/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../test.mk \ No newline at end of file diff --git a/test/fields/README.md b/test/fields/README.md deleted file mode 100644 index 8349e4e..0000000 --- a/test/fields/README.md +++ /dev/null @@ -1,17 +0,0 @@ -## Case Description - -Test case for complex object with `field`s declared inside them. - -## Parameters - -### Complex Object tests - -| Name | Description | Type | Value | -| --------------- | ---------------------------------------------------- | -------- | ------ | -| `foo` | Configuration for foo | `object` | `null` | -| `foo.db` | Field with custom type declared locally | `object` | | -| `foo.db.size` | Sub-field declared with path relative to custom type | `string` | | -| `bar` | Configuration for bar | `object` | `null` | -| `bar.db` | Field with custom type declared locally | `object` | | -| `bar.db.size` | Sub-field declared with path relative to custom type | `string` | | -| `bar.db.volume` | Sub-field declared with absolute path | `string` | | diff --git a/test/lists/Makefile b/test/lists/Makefile index 92bdef8..32e9003 100644 --- a/test/lists/Makefile +++ b/test/lists/Makefile @@ -1 +1 @@ -include ../test.mk \ No newline at end of file +include ../test.mk diff --git a/test/lists/README.md b/test/lists/README.md index 1f3f214..2ffe3c8 100644 --- a/test/lists/README.md +++ b/test/lists/README.md @@ -3,25 +3,51 @@ Cases for lists of `int`, `string`, and `object`. ## Parameters - ### Integer lists -| Name | Description | Type | Value | -| ------------------------- | ------------------------------------------------- | -------- | ------ | -| `intList` | A required list of integers, empty. | `[]int` | `null` | -| `intListSingle` | A list of integers with one value. | `[]int` | `null` | -| `intListMultiple` | A list of integers with one value. | `[]int` | `null` | -| `intListNullable` | A nullable list of integers, empty. | `[]*int` | `null` | -| `intListNullableSingle` | A nullable list of integers with one value. | `[]*int` | `null` | -| `intListNullableMultiple` | A nullable list of integers with multiple values. | `[]*int` | `null` | +| Name | Description | Type | Value | +| ------------------------- | ------------------------------------------------- | -------- | ------------ | +| `intList` | A required list of integers, empty. | `[]int` | `[]` | +| `intListSingle` | A list of integers with one value. | `[]int` | `[80]` | +| `intListMultiple` | A list of integers with multiple values. | `[]int` | `[80, 8080]` | +| `intListNullable` | A nullable list of integers, empty. | `[]*int` | `[]` | +| `intListNullableSingle` | A nullable list of integers with one value. | `[]*int` | `[80]` | +| `intListNullableMultiple` | A nullable list of integers with multiple values. | `[]*int` | `[80, 8080]` | + ### String lists -| Name | Description | Type | Value | -| ---------------------------- | ------------------------------------------------ | ----------- | ------ | -| `stringList` | A required list of strings, empty. | `[]string` | `null` | -| `stringListSingle` | A required list of strings with one value. | `[]string` | `null` | -| `stringListMultiple` | A required list of strings with multiple values. | `[]string` | `null` | -| `stringListNullable` | A nullable list of strings, empty. | `[]*string` | `null` | -| `stringListNullableSingle` | A nullable list of strings with one value. | `[]*string` | `null` | -| `stringListNullableMultiple` | A nullable list of strings with multiple values. | `[]*string` | `null` | +| Name | Description | Type | Value | +| ----------------------------- | ------------------------------------------------ | ----------- | ---------------- | +| `stringList` | A required list of strings, empty. | `[]string` | `[]` | +| `stringListSingle` | A required list of strings with one value. | `[]string` | `[user1]` | +| `stringListMultiple` | A required list of strings with multiple values. | `[]string` | `[user1, user2]` | +| `stringListNullable` | A nullable list of strings, empty. | `*[]string` | `null` | +| `stringListNullableSingle` | A nullable list of strings with one value. | `*[]string` | `[user1]` | +| `stringListNullableMultiple` | A nullable list of strings with multiple values. | `*[]string` | `[user1, user2]` | +| `stringListNullable2` | A nullable list of strings, empty. | `[]*string` | `[]` | +| `stringListNullableSingle2` | A nullable list of strings with one value. | `[]*string` | `[user1]` | +| `stringListNullableMultiple2` | A nullable list of strings with multiple values. | `[]*string` | `[user1, user2]` | + + +### Object lists + +| Name | Description | Type | Value | +| ------------------------ | -------------------------------------------- | ---------------- | -------------------------------------------------- | +| `objectList` | List of nested objects | `[]nestedObject` | `[]` | +| `objectList[0].name` | String field | `string` | `example` | +| `objectList[0].foo` | Object field with custom declared type | `object` | `{}` | +| `objectList[0].foo.fizz` | Nested int field | `int` | `10` | +| `objectList[0].foo.buzz` | Nested quantity field, nullable | `*string` | `1GiB` | +| `objectList[0].bar` | Another object field of custom declared type | `object` | `{}` | +| `objectList[0].bar.fizz` | Nested int field | `int` | `20` | +| `objectList[0].bar.buzz` | Nested quantity field, nullable | `*string` | `2GiB` | +| `objectList[1].name` | String field | `string` | `example 2 - not expected to appear in the README` | +| `objectList[1].foo` | Object field with custom declared type | `object` | `{}` | +| `objectList[1].foo.fizz` | Nested int field | `int` | `10` | +| `objectList[1].foo.buzz` | Nested quantity field, nullable | `*string` | `1GiB` | +| `objectList[1].bar` | Another object field of custom declared type | `object` | `{}` | +| `objectList[1].bar.fizz` | Nested int field | `int` | `20` | +| `objectList[1].bar.buzz` | Nested quantity field, nullable | `*string` | `2GiB` | + + diff --git a/test/lists/values.schema.json b/test/lists/values.schema.json index faf0b42..37016e2 100644 --- a/test/lists/values.schema.json +++ b/test/lists/values.schema.json @@ -10,8 +10,12 @@ } }, "intListMultiple": { - "description": "A list of integers with one value.", + "description": "A list of integers with multiple values.", "type": "array", + "default": [ + 80, + 8080 + ], "items": { "type": "integer" } @@ -26,6 +30,10 @@ "intListNullableMultiple": { "description": "A nullable list of integers with multiple values.", "type": "array", + "default": [ + 80, + 8080 + ], "items": { "type": "integer" } @@ -33,6 +41,9 @@ "intListNullableSingle": { "description": "A nullable list of integers with one value.", "type": "array", + "default": [ + 80 + ], "items": { "type": "integer" } @@ -40,10 +51,42 @@ "intListSingle": { "description": "A list of integers with one value.", "type": "array", + "default": [ + 80 + ], "items": { "type": "integer" } }, + "objectList": { + "description": "List of nested objects", + "type": "array", + "default": [ + { + "bar": { + "buzz": "2GiB", + "fizz": 20 + }, + "foo": { + "buzz": "1GiB", + "fizz": 10 + }, + "name": "example" + }, + { + "bar": { + "buzz": "2GiB", + "fizz": 20 + }, + "foo": { + "buzz": "1GiB", + "fizz": 10 + }, + "name": "example 2 - not expected to appear in the README" + } + ], + "items": {} + }, "stringList": { "description": "A required list of strings, empty.", "type": "array", @@ -54,6 +97,10 @@ "stringListMultiple": { "description": "A required list of strings with multiple values.", "type": "array", + "default": [ + "user1", + "user2" + ], "items": { "type": "string" } @@ -65,9 +112,31 @@ "type": "string" } }, + "stringListNullable2": { + "description": "A nullable list of strings, empty.", + "type": "array", + "items": { + "type": "string" + } + }, "stringListNullableMultiple": { "description": "A nullable list of strings with multiple values.", "type": "array", + "default": [ + "user1", + "user2" + ], + "items": { + "type": "string" + } + }, + "stringListNullableMultiple2": { + "description": "A nullable list of strings with multiple values.", + "type": "array", + "default": [ + "user1", + "user2" + ], "items": { "type": "string" } @@ -75,6 +144,19 @@ "stringListNullableSingle": { "description": "A nullable list of strings with one value.", "type": "array", + "default": [ + "user1" + ], + "items": { + "type": "string" + } + }, + "stringListNullableSingle2": { + "description": "A nullable list of strings with one value.", + "type": "array", + "default": [ + "user1" + ], "items": { "type": "string" } @@ -82,6 +164,9 @@ "stringListSingle": { "description": "A required list of strings with one value.", "type": "array", + "default": [ + "user1" + ], "items": { "type": "string" } diff --git a/test/lists/values.yaml b/test/lists/values.yaml index 73a2561..d98c551 100644 --- a/test/lists/values.yaml +++ b/test/lists/values.yaml @@ -7,7 +7,7 @@ intList: intListSingle: - 80 -## @param intListMultiple {[]int} A list of integers with one value. +## @param intListMultiple {[]int} A list of integers with multiple values. intListMultiple: - 80 - 8080 @@ -38,14 +38,54 @@ stringListMultiple: - "user1" - "user2" -## @param stringListNullable {[]*string} A nullable list of strings, empty. +## @param stringListNullable {*[]string} A nullable list of strings, empty. stringListNullable: -## @param stringListNullableSingle {[]*string} A nullable list of strings with one value. +## @param stringListNullableSingle {*[]string} A nullable list of strings with one value. stringListNullableSingle: - "user1" -## @param stringListNullableMultiple {[]*string} A nullable list of strings with multiple values. +## @param stringListNullableMultiple {*[]string} A nullable list of strings with multiple values. stringListNullableMultiple: - "user1" - - "user2" \ No newline at end of file + - "user2" + +## @param stringListNullable2 {[]*string} A nullable list of strings, empty. +stringListNullable2: + +## @param stringListNullableSingle2 {[]*string} A nullable list of strings with one value. +stringListNullableSingle2: + - "user1" + +## @param stringListNullableMultiple2 {[]*string} A nullable list of strings with multiple values. +stringListNullableMultiple2: + - "user1" + - "user2" + + +## @section Object lists +## +## For example, see metricsStorages in extra/monitoring +## @param objectList {[]nestedObject} List of nested objects +## @field nestedObject Nested object +## @field nestedObject.name {string} String field +## @field nestedObject.foo {fooType} Object field with custom declared type +## @field fooType.fizz {int} Nested int field +## @field fooType.buzz {*quantity} Nested quantity field, nullable +## @field nestedObject.bar {fooType} Another object field of custom declared type + +objectList: + - name: "example" + foo: + fizz: 10 + buzz: 1GiB + bar: + fizz: 20 + buzz: 2GiB + - name: "example 2 - not expected to appear in the README" + foo: + fizz: 10 + buzz: 1GiB + bar: + fizz: 20 + buzz: 2GiB \ No newline at end of file diff --git a/test/objects/Makefile b/test/objects/Makefile new file mode 100644 index 0000000..32e9003 --- /dev/null +++ b/test/objects/Makefile @@ -0,0 +1 @@ +include ../test.mk diff --git a/test/objects/README.md b/test/objects/README.md new file mode 100644 index 0000000..30f6ac2 --- /dev/null +++ b/test/objects/README.md @@ -0,0 +1,22 @@ +## Case Description + +Test case for complex object with `field`s declared inside them. + +## Parameters +### Declaration through custom type + +| Name | Description | Type | Value | +| ----- | --------------------- | -------- | ----- | +| `foo` | Configuration for foo | `object` | `{}` | + + +### Declaration with direct path + +| Name | Description | Type | Value | +| --------------- | --------------------------------------- | -------- | ----- | +| `bar` | Configuration for bar | `object` | `{}` | +| `bar.db` | Field with custom type declared locally | `object` | `{}` | +| `bar.db.size` | Sub-field declared with absolute path | `string` | `""` | +| `bar.db.volume` | Sub-field declared with absolute path | `string` | `""` | + + diff --git a/test/fields/values.schema.json b/test/objects/values.schema.json similarity index 54% rename from test/fields/values.schema.json rename to test/objects/values.schema.json index 5393e90..e74721b 100644 --- a/test/fields/values.schema.json +++ b/test/objects/values.schema.json @@ -5,6 +5,12 @@ "bar": { "description": "Configuration for bar", "type": "object", + "default": { + "db": { + "size": "10Gi", + "volume": "10Gi" + } + }, "required": [ "db" ], @@ -12,13 +18,24 @@ "db": { "description": "Field with custom type declared locally", "type": "object", + "default": { + "size": "10Gi", + "volume": "10Gi" + }, "required": [ - "size" + "size", + "volume" ], "properties": { "size": { "description": "Sub-field declared with path relative to custom type", - "type": "string" + "type": "string", + "default": "10Gi" + }, + "volume": { + "description": "Sub-field declared with path relative to custom type", + "type": "string", + "default": "10Gi" } } } @@ -27,6 +44,12 @@ "foo": { "description": "Configuration for foo", "type": "object", + "default": { + "db": { + "size": "10Gi", + "volume": "10Gi" + } + }, "required": [ "db" ], @@ -34,14 +57,24 @@ "db": { "description": "Field with custom type declared locally", "type": "object", + "default": { + "size": "10Gi", + "volume": "10Gi" + }, "required": [ - "size" + "size", + "volume" ], "properties": { "size": { "description": "Sub-field declared with path relative to custom type", "type": "string", "default": "10Gi" + }, + "volume": { + "description": "Sub-field declared with path relative to custom type", + "type": "string", + "default": "10Gi" } } } diff --git a/test/fields/values.yaml b/test/objects/values.yaml similarity index 54% rename from test/fields/values.yaml rename to test/objects/values.yaml index dd28db5..7dac4f4 100644 --- a/test/fields/values.yaml +++ b/test/objects/values.yaml @@ -1,18 +1,21 @@ -## @section Complex Object tests +## @section Declaration through custom type ## @param foo {foo} Configuration for foo ## @field foo.db {fooDB} Field with custom type declared locally ## @field fooDB.size {string} Sub-field declared with path relative to custom type +## @field fooDB.volume {string} Sub-field declared with path relative to custom type foo: db: size: 10Gi + volume: 10Gi + +## @section Declaration with direct path ## @param bar {bar} Configuration for bar -## @field bar.db {barDB} Field with custom type declared locally -## @field barDB.size {string} Sub-field declared with path relative to custom type +## @field bar.db {fooDB} Field with custom type declared locally +## @field bar.db.size {string} Sub-field declared with absolute path ## @field bar.db.volume {string} Sub-field declared with absolute path - bar: db: size: 10Gi diff --git a/test/template/Makefile b/test/template/Makefile index 92bdef8..32e9003 100644 --- a/test/template/Makefile +++ b/test/template/Makefile @@ -1 +1 @@ -include ../test.mk \ No newline at end of file +include ../test.mk diff --git a/test/template/README.md b/test/template/README.md index 8f0e6db..ebbcbd7 100644 --- a/test/template/README.md +++ b/test/template/README.md @@ -2,9 +2,10 @@ ## Parameters - ### Test configuration -| Name | Description | Type | Value | -| ------ | ------------- | -------- | ------ | -| `test` | Test variable | `object` | `null` | +| Name | Description | Type | Value | +| ------ | ------------- | -------- | ----- | +| `test` | Test variable | `object` | `{}` | + + diff --git a/test/template/values.schema.json b/test/template/values.schema.json index 80ae2a5..6931ef1 100644 --- a/test/template/values.schema.json +++ b/test/template/values.schema.json @@ -3,7 +3,8 @@ "type": "object", "properties": { "test": { - "description": "Test variable" + "description": "Test variable", + "type": "object" } } } \ No newline at end of file