-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Unittest for suggestions #709
Conversation
The failure of Packages CI flow on |
Packages/build-deb CI flows failed on ubuntu-bionic and ubuntu-focal with the following mismatch in the ServerTest.suggestions unit-test: ``` [ RUN ] ServerTest.suggestions ../test/server.cpp:715: Failure Expected equality of these values: r->body Which is: ... removeEOLWhitespaceMarkers(expectedResponse) Which is: ... With diff: @@ -2,5 +2,5 @@ { \"value\" : \"Ray (movie)\", - \"label\" : \"Ray (<b>movie</b>...\", + \"label\" : \"Ray (<b>movie</b>)\", \"kind\" : \"path\" , \"path\" : \"A/Ray_(movie)\" Test context: url: /ROOT/suggest?content=zimfile&term=movie ``` For some reason (probably, a bug), the implementation of `Xapian::MSet::snippet()` on those platforms decided that a single closing parenthesis is more than is appropriate for inclusion in the snippet and replaced it with a (longer) ellipsis. Taking advantage of the necessity to work around that bug, the ServerTest.suggestions's functional coverage was enhanced - the problematic test point was replaced with a new one using a phrase instead of a single term.
Codecov Report
@@ Coverage Diff @@
## master #709 +/- ##
=======================================
Coverage 57.96% 57.96%
=======================================
Files 54 54
Lines 3566 3566
Branches 2006 2006
=======================================
Hits 2067 2067
Misses 1498 1498
Partials 1 1 Continue to review full report at Codecov.
|
CI is now clean. This PR is ready for review. I added the commit addressing the CI failure as a non-fixup commit and intend to keep it as such since it documents an issue with Xapian. |
// Output generated via mustache templates sometimes contains end-of-line | ||
// whitespace. This complicates representing the expected output of a unit-test | ||
// as C++ raw strings in editors that are configured to delete EOL whitespace. | ||
// A workaround is to put special markers (//EOLWHITESPACEMARKER) at the end | ||
// of such lines in the expected output string and remove them at runtime. | ||
// This is exactly what this function is for. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is silly but I don't know how to do otherwise.
This PR is part of a larger campaign of extending the
kiwix-serve
test-suite, so that major changes related to kiwix/kiwix-tools#59 and #650 can be implemented in a safer environment.