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

Unittest for suggestions #709

Merged
merged 3 commits into from
Feb 16, 2022
Merged

Unittest for suggestions #709

merged 3 commits into from
Feb 16, 2022

Conversation

veloman-yunkan
Copy link
Collaborator

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.

@veloman-yunkan
Copy link
Collaborator Author

The failure of Packages CI flow on ubuntu-focal and ubuntu-bionic is probably caused by the difference in the libxapian version (and a likely recent bugfix in Xapian::MSet::snippet())

@kelson42 kelson42 added this to the 10.1.0 milestone Feb 11, 2022
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
Copy link

codecov bot commented Feb 14, 2022

Codecov Report

Merging #709 (c782cc7) into master (ec94d9b) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ec94d9b...c782cc7. Read the comment docs.

@veloman-yunkan
Copy link
Collaborator Author

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.

Comment on lines +48 to +53
// 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.
Copy link
Member

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.

@mgautierfr mgautierfr merged commit 62ba2f4 into master Feb 16, 2022
@mgautierfr mgautierfr deleted the unittest_for_suggestions branch February 16, 2022 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants