[pve-devel] [PATCH pve-common v1 04/23] tests: sectionconfig: add case for unused properties
Fabian Grünbichler
f.gruenbichler at proxmox.com
Thu Jan 15 13:47:36 CET 2026
On December 19, 2025 8:44 pm, Max R. Carrara wrote:
> Add a PVE::SectionConfig test case where plugins define properties
> but then don't declare them in `options()`.
>
> In unified mode, properties added but not used in any `options()`
> method anywhere are excluded from the update schema.
does this make sense? or is it a bug that should be fixed? I'd expect
those to be omitted from the createSchema as well?
the same questions apply to the next patch (optional default properties
not used in any options) as well..
> In isolated mode, these properties are still implicitly declared as
> being used—in other words, it's not necessary to declare (non-default)
> properties in `options()`, unless the plugin author needs to (e.g. in
> order to make a property `fixed`).
this I can see as somewhat useful behaviour - no need to duplicate
information. although it is a bit confusing in practice I guess..
>
> Signed-off-by: Max R. Carrara <m.carrara at proxmox.com>
> ---
> test/SectionConfig/schema_comparison_test.pl | 159 +++++++++++++++++++
> 1 file changed, 159 insertions(+)
>
> diff --git a/test/SectionConfig/schema_comparison_test.pl b/test/SectionConfig/schema_comparison_test.pl
> index 8f7921f..861792c 100755
> --- a/test/SectionConfig/schema_comparison_test.pl
> +++ b/test/SectionConfig/schema_comparison_test.pl
> @@ -376,6 +376,165 @@ package OneOptionalAllFixedNoCommon {
> }
> };
>
> +package AllUnusedNoCommon {
> + use base qw(TestPackage);
> +
> + sub desc($class) {
> + return
> + "in unified mode, properties that plugins define but"
> + . " do not declare in options() are *not* included in updateSchema"
> + . " - in isolated mode, these properties are however included";
> + }
> +
> + package AllUnusedNoCommon::PluginBase {
> + use base qw(PVE::SectionConfig);
> +
> + my $DEFAULT_DATA = {};
> +
> + sub private($class) {
> + return $DEFAULT_DATA;
> + }
> + };
> +
> + package AllUnusedNoCommon::PluginOne {
> + use base qw(AllUnusedNoCommon::PluginBase);
> +
> + sub type($class) {
> + return 'one';
> + }
> +
> + sub properties($class) {
> + return {
> + 'prop-one' => {
> + type => 'string',
> + optional => 0,
> + },
> + };
> + }
> +
> + sub options($class) {
> + return {};
> + }
> + };
> +
> + package AllUnusedNoCommon::PluginTwo {
> + use base qw(AllUnusedNoCommon::PluginBase);
> +
> + sub type($class) {
> + return 'two';
> + }
> +
> + sub properties($class) {
> + return {
> + 'prop-two' => {
> + type => 'string',
> + optional => 1,
> + },
> + };
> + }
> +
> + sub options($class) {
> + return {};
> + }
> + };
> +
> + sub expected_unified_createSchema($class) {
> + return {
> + type => 'object',
> + additionalProperties => 0,
> + properties => {
> + type => {
> + type => 'string',
> + enum => [
> + "one", "two",
> + ],
> + },
> + 'prop-one' => {
> + type => 'string',
> + optional => 1,
> + },
> + 'prop-two' => {
> + type => 'string',
> + optional => 1,
> + },
> + },
> + };
> + }
> +
> + sub expected_unified_updateSchema($class) {
> + return {
> + type => 'object',
> + additionalProperties => 0,
> + properties => {
> + $SectionConfig::Helpers::UPDATE_SCHEMA_DEFAULT_PROPERTIES->%*,
> + },
> + };
> + }
> +
> + sub expected_isolated_createSchema($class) {
> + return {
> + type => 'object',
> + additionalProperties => 0,
> + properties => {
> + type => {
> + type => 'string',
> + enum => [
> + "one", "two",
> + ],
> + },
> + 'prop-one' => {
> + 'instance-types' => [
> + "one",
> + ],
> + 'type-property' => 'type',
> + type => 'string',
> + optional => 1,
> + },
> + 'prop-two' => {
> + 'instance-types' => [
> + "two",
> + ],
> + 'type-property' => 'type',
> + type => 'string',
> + optional => 1,
> + },
> + },
> + };
> + }
> +
> + sub expected_isolated_updateSchema($class) {
> + return {
> + type => 'object',
> + additionalProperties => 0,
> + properties => {
> + type => {
> + type => 'string',
> + enum => [
> + "one", "two",
> + ],
> + },
> + 'prop-one' => {
> + 'instance-types' => [
> + "one",
> + ],
> + 'type-property' => 'type',
> + type => 'string',
> + optional => 1,
> + },
> + 'prop-two' => {
> + 'instance-types' => [
> + "two",
> + ],
> + 'type-property' => 'type',
> + type => 'string',
> + optional => 1,
> + },
> + $SectionConfig::Helpers::UPDATE_SCHEMA_DEFAULT_PROPERTIES->%*,
> + },
> + };
> + }
> +}
> +
> sub test_compare_deeply($got, $expected, $test_name, $test_package) {
> $test_name = "$test_package - $test_name";
> my $description = $test_package->desc();
> --
> 2.47.3
>
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
More information about the pve-devel
mailing list