From 440025e25d51021fa3d5428fa3e31600b2f17389 Mon Sep 17 00:00:00 2001 From: Simon Pichugin Date: Tue, 7 Nov 2017 19:34:02 +0100 Subject: [PATCH] Issue 48393 - Add a test case for nsds5ReplicaId checks Description: We need to check that nsDS5ReplicaId accepts only valid values and can be changed back to the original value. Currently it fails during the changing back to the original value operation. https://pagure.io/389-ds-base/issue/48393 https://pagure.io/389-ds-base/issue/49408 Reviewed by: ? --- .../suites/replication/replica_config_test.py | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/dirsrvtests/tests/suites/replication/replica_config_test.py b/dirsrvtests/tests/suites/replication/replica_config_test.py index 50ea2ece9..3f3603c11 100644 --- a/dirsrvtests/tests/suites/replication/replica_config_test.py +++ b/dirsrvtests/tests/suites/replication/replica_config_test.py @@ -389,6 +389,47 @@ def test_agmt_num_modify(topo, attr, too_small, too_big, overflow, notnum, valid assert False +def test_replicaid_modification(topo): + """Check that nsDS5ReplicaId accepts only valid values + and can be changed back to the original value + + :id: 7dcab36f-2113-4e24-ab3d-01843ce65cac + :setup: Standalone instance + :steps: + 1. Enable replication + 2. Get current nsDS5ReplicaId value + 3. Try to set valid values to nsDS5ReplicaId + 4. Try to set invalid values to nsDS5ReplicaId + 5. Set nsDS5ReplicaId to the old value + 6. Disable replication + :expectedresults: + 1. Operation should be successful + 2. Operation should be successful + 3. Operation should be successful + 4. Unwilling to perform error should be raised + 5. Operation should be successful + 6. Operation should be successful + """ + + log.info('Add a replica entry') + replica = topo.standalone.replicas.enable(suffix=DEFAULT_SUFFIX, + role=ReplicaRole.MASTER, + replicaID=REPLICAID_MASTER_1) + + log.info('Set {} to valid value'.format(REPL_ID)) + replica.set(REPL_ID, str(REPLICAID_MASTER_1 + 1)) + + log.info('Set {} to invalid value'.format(REPL_ID)) + with pytest.raises(ldap.UNWILLING_TO_PERFORM): + replica.set(REPL_ID, "wrong_id") + + log.info('Set {} to original value'.format(REPL_ID)) + replica.set(REPL_ID, str(REPLICAID_MASTER_1)) + + log.info('Remove a replica entry') + replica.disable(suffix=DEFAULT_SUFFIX) + + if __name__ == '__main__': # Run isolated # -s for DEBUG mode -- 2.13.6