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

test: refactor driver test #1452

Merged
merged 6 commits into from
Dec 17, 2020
Merged

test: refactor driver test #1452

merged 6 commits into from
Dec 17, 2020

Conversation

bwanglzu
Copy link
Member

@bwanglzu bwanglzu commented Dec 13, 2020

minor test refactoring on the querylang and driver

@bwanglzu bwanglzu self-assigned this Dec 13, 2020
@jina-bot jina-bot added size/M area/core This issue/PR affects the core codebase area/helper This issue/PR affects the helper functionality area/testing This issue/PR affects testing component/driver labels Dec 13, 2020
@bwanglzu bwanglzu marked this pull request as ready for review December 13, 2020 13:17
@bwanglzu bwanglzu requested a review from a team as a code owner December 13, 2020 13:17
@@ -41,17 +41,15 @@ def create_document_to_score():
# |- matches: (id: 3, parent_id: 1, score.value: 3),
# |- matches: (id: 4, parent_id: 1, score.value: 4),
# |- matches: (id: 5, parent_id: 1, score.value: 5),

doc = jina_pb2.DocumentProto()
doc = Document()
Copy link
Member

Choose a reason for hiding this comment

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

the idea herr is to see if we can refactor the logic of the test itself to be less dependant on id? I am not sure it is possible though

Copy link
Member

Choose a reason for hiding this comment

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

One problem is that this test is so dependant on document logic that any document refactor involves a lot of effort to regfactor these tests. is there a way to avoid this?

Copy link
Member Author

Choose a reason for hiding this comment

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

the option I can see is to maintain fixtures in a separate file so that we can reuse/modify it anywhere

Copy link
Member

Choose a reason for hiding this comment

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

butis there so many shared code?

Copy link
Member Author

@bwanglzu bwanglzu Dec 14, 2020

Choose a reason for hiding this comment

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

there could be, if we "composite" small fixtures into bigger ones, a lot of code are actually shared, from low levels.

Copy link
Member

Choose a reason for hiding this comment

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

okey that'd be great.

@github-actions
Copy link

github-actions bot commented Dec 13, 2020

Latency summary

Current PR yields:

  • 😶 index QPS at 2186, delta to last 3 avg.: -2%
  • 🐎🐎 query QPS at 41, delta to last 3 avg.: +10%

Breakdown

Version Index QPS Query QPS
current 2186 41
0.8.7 2254 37
0.8.6 2253 37
0.8.5 2245 35

Backed by latency-tracking. Further commits will update this comment.

@bwanglzu bwanglzu marked this pull request as draft December 13, 2020 20:56
@bwanglzu bwanglzu changed the title test: refactor driver test: refactor driver test Dec 14, 2020
tests/integration/hub_usage/dummyhub_abs/__init__.py Outdated Show resolved Hide resolved
@@ -41,17 +41,15 @@ def create_document_to_score():
# |- matches: (id: 3, parent_id: 1, score.value: 3),
# |- matches: (id: 4, parent_id: 1, score.value: 4),
# |- matches: (id: 5, parent_id: 1, score.value: 5),

doc = jina_pb2.DocumentProto()
doc = Document()
Copy link
Member

Choose a reason for hiding this comment

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

okey that'd be great.

@bwanglzu bwanglzu marked this pull request as ready for review December 14, 2020 22:43
@bwanglzu
Copy link
Member Author

related to #975 , hubio test both locally and in the ci.

@bwanglzu
Copy link
Member Author

local test passed after running docker build -f Dockerfiles/pip.Dockerfile -t jinaai/jina:test-pip .

Copy link
Member

@nan-wang nan-wang left a comment

Choose a reason for hiding this comment

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

minor changes

assert len(filtered_docs) == 1
for d in filtered_docs:
assert int(d.tags['id']) == 4
assert len(d.chunks) == 5
Copy link
Member

Choose a reason for hiding this comment

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

Is there any specific reason to check the number of chunks here?

Suggested change
assert len(d.chunks) == 5
assert len(d.chunks) == 5

@codecov
Copy link

codecov bot commented Dec 16, 2020

Codecov Report

Merging #1452 (1a33145) into master (08fa53e) will increase coverage by 0.24%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1452      +/-   ##
==========================================
+ Coverage   82.76%   83.00%   +0.24%     
==========================================
  Files         110      110              
  Lines        6381     6443      +62     
==========================================
+ Hits         5281     5348      +67     
+ Misses       1100     1095       -5     
Impacted Files Coverage Δ
jina/drivers/querylang/queryset/helper.py 92.30% <100.00%> (-0.55%) ⬇️
jina/excepts.py 100.00% <100.00%> (ø)
jina/logging/profile.py 68.33% <0.00%> (-0.58%) ⬇️
jina/drivers/craft.py 100.00% <0.00%> (ø)
jina/types/ndarray/generic.py 100.00% <0.00%> (ø)
jina/executors/indexers/cache.py 100.00% <0.00%> (ø)
jina/executors/evaluators/text/length.py 100.00% <0.00%> (ø)
jina/executors/evaluators/rank/precision.py 100.00% <0.00%> (ø)
jina/peapods/peas/__init__.py 90.72% <0.00%> (+0.03%) ⬆️
jina/drivers/evaluate.py 98.21% <0.00%> (+0.03%) ⬆️
... and 22 more

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 771d9bc...5e0ee4c. Read the comment docs.

@nan-wang nan-wang merged commit 2d0c489 into master Dec 17, 2020
@nan-wang nan-wang deleted the test-refactor-querylang branch December 17, 2020 04:28
@bwanglzu
Copy link
Member Author

@nan-wang sorry I was off yesterday, just saw your message. The test was actually copied from another file test_queryset.py, I merged test_queryset into test_lookup since they're in the same file in our codebase. I think the objective of the test is just to double check number of chunks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core This issue/PR affects the core codebase area/helper This issue/PR affects the helper functionality area/testing This issue/PR affects testing component/driver size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants