Repository navigation
Add characterization tests for SyncRepl (SyncRepl 18% -> 99% line coverage) - #119
Open
opravil-jan wants to merge 2 commits into
Open
opravil-jan wants to merge 2 commits into
opravil-jan wants to merge 2 commits into
Conversation
junit-platform-runner pulled JUnit 4 onto the test classpath, so surefire auto-detected the JUnit4 provider and discovered none of the Jupiter tests: every plugin module reported "Tests run: 0" and the build stayed green. Nothing uses the runner, so drop it together with the now unused junit.platform.version property. Hamcrest was only reachable transitively through JUnit 4; its single user, EntryEditorWidgetSorterTest, now asserts with JUnit's assertEquals like the other test classes. Surefire now runs 360 unit tests across 10 plugins (2 skipped). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Pin down the current behaviour of every SyncRepl option: getters and setters, copy(), toString(), parsing of all 35 keywords and their enum values, invalid values, and round trips, so that upcoming fixes cannot silently change anything else. Line coverage of SyncRepl goes from 18% to 99% and of SyncReplParser from 55% to 96%. Exact output strings are only asserted where Studio already writes what slapd's syncrepl_unparse()/bindconf_unparse() write. Differences from slapd and suspected bugs are @disabled tests that assert the correct behaviour, to be enabled together with the fix. Among them: exattrs= is read as attrs=, unknown options are dropped on save, and the cipher suite uses tls_ciphersuite= where slapd only knows tls_cipher_suite=. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR changes tests only; production code is untouched. It pins down the current behaviour of
plugins/openldap.syncrepl, so that later fixes cannot silently change anything else.What is covered
There are 4 new test classes with 63 tests:
copy()for every option.toString()for every option.SyncReplSyncReplParserCoverage was measured with JaCoCo 0.8.15. Each new class was mutation-checked: I broke a targeted production line and confirmed that a test fails.
Not cementing divergences from slapd
Exact output strings are asserted only where Studio already writes what slapd itself writes, as checked in OpenLDAP master (
syncrepl_unparse()insyncrepl.c,bindconf_unparse()and thebindkeytable inconfig.c). For cn=config values, slapd quotes a fixed set of fields and escapes nothing, becausestrtok_quote_ldif()has no escape mechanism. Where Studio differs, the test asserts the slapd behaviour and is@Disabled. Every disabled test was enabled once and fails for the stated reason.Suspected bugs (7):
exattrs=userPasswordis read asattrs=userPassword. Keywords are matched anywhere in the text, because the parser skips one character when nothing matches. The attribute meant to be excluded therefore becomes the only replicated attribute, and that is written back on save.xrid=5is read asrid=5.lazycommit,suffixmassage,tls_protocol_min,exattrs) are silently dropped, so they disappear from the value when it is saved.tls_ciphersuite=, but slapd only knowstls_cipher_suite=. slapd rejects the value Studio writes, and the cipher suite of an existing consumer is lost. There are 2 tests, one for writing and one for reading.filter=at the very end of the value throwsArrayIndexOutOfBoundsException(SyncReplParser.java:1025) instead of a parser error.rid, whichever option it is.Known divergences from slapd (5):
credentialsand thetls_cert/tls_key/tls_cacert/tls_cacertdirpaths are written unquoted.\"is treated as an escape, a quote that is not followed by whitespace closes the value, and'...'is accepted as quoting.Fixed by #117 (1):
tls_cacertdirround trip.Two cases are deliberately left untested, with a comment in the test class:
"inside a quoted value: no output string lets slapd read it back unchanged.strncasecmp.Verification
mvn clean install(Maven 3.9.16, JDK 17): openldap.syncrepl ran 140 tests, of which 127 passed and 13 were skipped (the disabled tests above).openldap.config.editorpassed all 34 of its tests.🤖 Generated with Claude Code