Skip to content

Commit d3e517f

Browse files
committed
add a pack config test for additionalItems: true
1 parent 1463f4d commit d3e517f

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

st2common/tests/unit/test_config_loader.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,21 @@ def test_get_config_dynamic_config_item_under_additional_items(self):
762762
# schema declares `secret: true` which triggers auto-decryption.
763763
# If this were not encrypted, it would try to decrypt it and fail.
764764
},
765-
]
765+
],
766+
# foobar has additionalItems: true
767+
"foobar": [
768+
# there are no types to validate here
769+
5,
770+
"a string",
771+
{
772+
# there are no defaults to interpolate here
773+
"token": "hard-coded-secret",
774+
},
775+
{
776+
# nothing is marked `secret: true` so no auto-decryption occurs.
777+
"token": "{{st2kv.system.k1_encrypted|decrypt_kv}}",
778+
},
779+
],
766780
}
767781
config_db = ConfigDB(pack=pack_name, values=values)
768782
config_db = Config.add_or_update(config_db)
@@ -785,6 +799,17 @@ def test_get_config_dynamic_config_item_under_additional_items(self):
785799
"token": "v1_encrypted",
786800
},
787801
],
802+
"foobar": [
803+
5,
804+
"a string",
805+
{
806+
"token": "hard-coded-secret",
807+
},
808+
{
809+
"token": "v1_encrypted",
810+
},
811+
812+
],
788813
},
789814
)
790815

st2tests/st2tests/fixtures/packs/dummy_pack_schema_with_additional_items_1/config.schema.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@
2222
type: "string"
2323
required: true
2424
secret: true
25+
foobar:
26+
type: "array"
27+
required: false
28+
additionalItems: true

0 commit comments

Comments
 (0)