Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: t882 #3773

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions cts/cli/cibadmin_invalid_schema.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<cib crm_feature_set="3.19.5" validate-with="pacemaker-1.3" epoch="2" num_updates="0" admin_epoch="0">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pacemaker-1.3 is a valid schema - if the idea here is to test a schema version that doesn't exist, you should change this to something that's not in xml/pacemaker-*. Maybe 1.4, or 2.999, or something like that.

<configuration>
<crm_config>
<cluster_property_set id="cib-bootstrap-options">
<nvpair id="cib-bootstrap-options-stonith-enabled" name="stonith-enabled" value="false"/>
</cluster_property_set>
</crm_config>
<nodes/>
<resources/>
<constraints/>
<rsc_defaults>
<meta_attributes id="build-resource-defaults">
<nvpair id="build-resource-stickiness" name="resource-stickiness" value="1"/>
</meta_attributes>
</rsc_defaults>
<acls>
<acl_role id="acl-role"/>
<acl_user id="acl-user">
<role_ref id="acl-role"/>
</acl_user>
</acls>
</configuration>
<status/>
</cib>
90 changes: 53 additions & 37 deletions cts/cli/regression.upgrade.exp
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
=#=#=#= Begin test: Run cibadmin with upgrade and force flags =#=#=#=
pcmk__update_schema debug: Schema pacemaker-2.10 validates
pcmk__update_schema debug: Schema pacemaker-3.0 validates
pcmk__update_schema debug: Schema pacemaker-3.1 validates
pcmk__update_schema debug: Schema pacemaker-3.2 validates
pcmk__update_schema debug: Schema pacemaker-3.3 validates
pcmk__update_schema debug: Schema pacemaker-3.4 validates
pcmk__update_schema debug: Schema pacemaker-3.5 validates
pcmk__update_schema debug: Schema pacemaker-3.6 validates
pcmk__update_schema debug: Schema pacemaker-3.7 validates
pcmk__update_schema debug: Schema pacemaker-3.8 validates
pcmk__update_schema debug: Schema pacemaker-3.9 validates
pcmk__update_schema debug: Schema pacemaker-3.10 validates
pcmk__update_schema debug: Schema pacemaker-4.0 validates
pcmk__update_schema info: Transformed the configuration schema to pacemaker-4.0
=#=#=#= Current cib after: Run cibadmin with upgrade and force flags =#=#=#=
<cib epoch="1" num_updates="2" admin_epoch="1">
<configuration>
<crm_config/>
<nodes/>
<resources/>
<constraints/>
</configuration>
<status/>
</cib>
=#=#=#= End test: Run cibadmin with upgrade and force flags - OK (0) =#=#=#=
* Passed: cibadmin - Run cibadmin with upgrade and force flags
=#=#=#= Begin test: Set stonith-enabled=false =#=#=#=
=#=#=#= Current cib after: Set stonith-enabled=false =#=#=#=
<cib epoch="2" num_updates="0" admin_epoch="0">
<cib epoch="2" num_updates="0" admin_epoch="1">
<configuration>
<crm_config>
<cluster_property_set id="cib-bootstrap-options">
Expand All @@ -17,7 +44,7 @@
* Passed: crm_attribute - Set stonith-enabled=false
=#=#=#= Begin test: Configure the initial resource =#=#=#=
=#=#=#= Current cib after: Configure the initial resource =#=#=#=
<cib epoch="3" num_updates="0" admin_epoch="0">
<cib epoch="3" num_updates="0" admin_epoch="1">
<configuration>
<crm_config>
<cluster_property_set id="cib-bootstrap-options">
Expand Down Expand Up @@ -54,31 +81,8 @@
=#=#=#= End test: Configure the initial resource - OK (0) =#=#=#=
* Passed: cibadmin - Configure the initial resource
=#=#=#= Begin test: Upgrade to latest CIB schema (trigger 2.10.xsl + the wrapping) =#=#=#=
pcmk__update_schema debug: Schema pacemaker-2.10 validates
apply_upgrade debug: Upgrading schema from pacemaker-2.10 to pacemaker-3.0: applying XSL transform upgrade-2.10-0.xsl
apply_upgrade debug: Upgrading schema from pacemaker-2.10 to pacemaker-3.0: applying XSL transform upgrade-2.10-1.xsl
INFO: Resources-operation instance_attributes: mySmartFuse-monitor-inputpower (rsc=mySmartFuse, meta=mySmartFuse-inputpower-instanceparams): dropping requires
INFO: Resources-operation instance_attributes: ... only start/promote operation taken into account
INFO: Resources-operation instance_attributes: mySmartFuse-monitor-outputpower (rsc=mySmartFuse, meta=mySmartFuse-outputpower-instanceparams): dropping requires
INFO: Resources-operation instance_attributes: ... only start/promote operation taken into account
apply_upgrade debug: Upgrading schema from pacemaker-2.10 to pacemaker-3.0: applying XSL transform upgrade-2.10-2.xsl
DEBUG: instance_attributes: original element pointed to with @id-ref (mySmartFuse-outputpower-instanceparams) disappeared during upgrade
apply_upgrade info: Schema upgrade from pacemaker-2.10 to pacemaker-3.0 succeeded
pcmk__update_schema debug: Schema pacemaker-3.0 validates
pcmk__update_schema debug: Schema pacemaker-3.1 validates
pcmk__update_schema debug: Schema pacemaker-3.2 validates
pcmk__update_schema debug: Schema pacemaker-3.3 validates
pcmk__update_schema debug: Schema pacemaker-3.4 validates
pcmk__update_schema debug: Schema pacemaker-3.5 validates
pcmk__update_schema debug: Schema pacemaker-3.6 validates
pcmk__update_schema debug: Schema pacemaker-3.7 validates
pcmk__update_schema debug: Schema pacemaker-3.8 validates
pcmk__update_schema debug: Schema pacemaker-3.9 validates
pcmk__update_schema debug: Schema pacemaker-3.10 validates
pcmk__update_schema debug: Schema pacemaker-4.0 validates
pcmk__update_schema info: Transformed the configuration schema to pacemaker-4.0
=#=#=#= Current cib after: Upgrade to latest CIB schema (trigger 2.10.xsl + the wrapping) =#=#=#=
<cib epoch="2" num_updates="0" admin_epoch="1">
<cib epoch="3" num_updates="0" admin_epoch="1">
<configuration>
<crm_config>
<cluster_property_set id="cib-bootstrap-options">
Expand All @@ -90,16 +94,22 @@ pcmk__update_schema info: Transformed the configuration schema to pacemaker-4.0
<primitive id="mySmartFuse" class="ocf" provider="experiment" type="SmartFuse">
<operations>
<op id="mySmartFuse-start" name="start" interval="0" timeout="40s"/>
<op id="mySmartFuse-monitor-inputpower" name="monitor" interval="30s"/>
<op id="mySmartFuse-monitor-outputpower" name="monitor" interval="2s"/>
<op id="mySmartFuse-monitor-inputpower" name="monitor" interval="30s">
<instance_attributes id="mySmartFuse-inputpower-instanceparams">
<nvpair id="mySmartFuse-inputpower-requires" name="requires" value="inputpower"/>
</instance_attributes>
</op>
<op id="mySmartFuse-monitor-outputpower" name="monitor" interval="2s">
<instance_attributes id="mySmartFuse-outputpower-instanceparams">
<nvpair id="mySmartFuse-outputpower-requires" name="requires" value="outputpower"/>
</instance_attributes>
</op>
</operations>
<instance_attributes id="mySmartFuse-params">
<nvpair id="mySmartFuse-params-ip" name="ip" value="192.0.2.10"/>
</instance_attributes>
<!-- a bit hairy but valid -->
<instance_attributes id="_cibtr-2_mySmartFuse-outputpower-instanceparams">
<nvpair id="__cibtr-2_mySmartFuse-outputpower-instanceparams__mySmartFuse-outputpower-requires" name="requires" value="outputpower"/>
</instance_attributes>
<instance_attributes id-ref="mySmartFuse-outputpower-instanceparams"/>
</primitive>
</resources>
<constraints/>
Expand All @@ -111,7 +121,7 @@ pcmk__update_schema info: Transformed the configuration schema to pacemaker-4.0
=#=#=#= Begin test: Query a resource instance attribute (shall survive) =#=#=#=
outputpower
=#=#=#= Current cib after: Query a resource instance attribute (shall survive) =#=#=#=
<cib epoch="2" num_updates="0" admin_epoch="1">
<cib epoch="3" num_updates="0" admin_epoch="1">
<configuration>
<crm_config>
<cluster_property_set id="cib-bootstrap-options">
Expand All @@ -123,16 +133,22 @@ outputpower
<primitive id="mySmartFuse" class="ocf" provider="experiment" type="SmartFuse">
<operations>
<op id="mySmartFuse-start" name="start" interval="0" timeout="40s"/>
<op id="mySmartFuse-monitor-inputpower" name="monitor" interval="30s"/>
<op id="mySmartFuse-monitor-outputpower" name="monitor" interval="2s"/>
<op id="mySmartFuse-monitor-inputpower" name="monitor" interval="30s">
<instance_attributes id="mySmartFuse-inputpower-instanceparams">
<nvpair id="mySmartFuse-inputpower-requires" name="requires" value="inputpower"/>
</instance_attributes>
</op>
<op id="mySmartFuse-monitor-outputpower" name="monitor" interval="2s">
<instance_attributes id="mySmartFuse-outputpower-instanceparams">
<nvpair id="mySmartFuse-outputpower-requires" name="requires" value="outputpower"/>
</instance_attributes>
</op>
</operations>
<instance_attributes id="mySmartFuse-params">
<nvpair id="mySmartFuse-params-ip" name="ip" value="192.0.2.10"/>
</instance_attributes>
<!-- a bit hairy but valid -->
<instance_attributes id="_cibtr-2_mySmartFuse-outputpower-instanceparams">
<nvpair id="__cibtr-2_mySmartFuse-outputpower-instanceparams__mySmartFuse-outputpower-requires" name="requires" value="outputpower"/>
</instance_attributes>
<instance_attributes id-ref="mySmartFuse-outputpower-instanceparams"/>
</primitive>
</resources>
<constraints/>
Expand Down
54 changes: 52 additions & 2 deletions cts/cts-cli.in
Original file line number Diff line number Diff line change
Expand Up @@ -2933,7 +2933,7 @@ class UpgradeRegressionTest(RegressionTest):
@property
def tests(self):
"""A list of Test instances to be run as part of this regression test."""
resource_cib = """
resource_cib1 = """
<resources>
<primitive id="mySmartFuse" class="ocf" provider="experiment" type="SmartFuse">
<operations>
Expand All @@ -2956,13 +2956,63 @@ class UpgradeRegressionTest(RegressionTest):
<instance_attributes id-ref="mySmartFuse-outputpower-instanceparams"/>
</primitive>
</resources>
"""
resource_cib2 = """
waltdisgrace marked this conversation as resolved.
Show resolved Hide resolved
<cib crm_feature_set="3.19.5" validate-with="pacemaker-1.3" epoch="2" num_updates="0" admin_epoch="0">
<configuration>
<crm_config>
<cluster_property_set id="cib-bootstrap-options">
<nvpair id="cib-bootstrap-options-stonith-enabled" name="stonith-enabled" value="false"/>
</cluster_property_set>
</crm_config>
<nodes/>
<resources/>
<constraints/>
<rsc_defaults>
<meta_attributes id="build-resource-defaults">
<nvpair id="build-resource-stickiness" name="resource-stickiness" value="1"/>
</meta_attributes>
</rsc_defaults>
<acls>
<acl_role id="acl-role"/>
<acl_user id="acl-user">
<role_ref id="acl-role"/>
</acl_user>
</acls>
</configuration>
<status/>
</cib>
"""

t882_tests3 = [
Test("Run cibadmin with upgrade and force flags", "cibadmin -u --force",
update_cib=True),
]

t882_tests0 = [
Test("Run cibadmin with upgrade and force flags", "cibadmin -u --force",
update_cib=True),
]

t882_tests1 = [
Test("Run cibadmin with upgrade and force flags", "cibadmin -u --force -x '{cts_cli_data}/cibadmin_invalid_schema.xml'",
update_cib=True),
]

t882_tests2 = [
Test("Run cibadmin with upgrade and force flags", "cibadmin -u --force -p",
update_cib=True, stdin=resource_cib2),
]

basic_tests = [

TestGroup(t882_tests3,
env={"CIB_file": "{cts_cli_data}/cibadmin_invalid_schema.xml"}),
waltdisgrace marked this conversation as resolved.
Show resolved Hide resolved

waltdisgrace marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're not adding tests0, tests1, or tests2 to basic_tests so they will never be run. I think you were just experimenting with different ways of providing the input for the tests, right? In general, we're doing a pretty good job of testing that already so I think it's okay if you just use a single method here and remove all the others. In that case, you can also get rid of resource_cib2 because it's just duplicating what's in the XML file you add in a later patch.

Test("Set stonith-enabled=false", "crm_attribute -n stonith-enabled -v false",
update_cib=True),
Test("Configure the initial resource", "cibadmin -M -o resources -p",
update_cib=True, stdin=resource_cib),
update_cib=True, stdin=resource_cib1),
Test("Upgrade to latest CIB schema (trigger 2.10.xsl + the wrapping)",
"cibadmin --upgrade --force -V -V",
update_cib=True),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to run make to generate a new cts-cli program, and then run cts/cts-cli -s -r acls. This will generate a new regression output file. That change should also be included as a new patch in this PR.

Expand Down