Skip to content

Commit

Permalink
Merge pull request #53 from final-israel/multiple_tags_bug
Browse files Browse the repository at this point in the history
Multiple tags bug
  • Loading branch information
shiransh authored Mar 3, 2024
2 parents 8ef22bd + 7a09e72 commit 534566a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-mgmt-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:

- name: Stamp with vmn
id: vmn_version
uses: progovoy/vmn-action@vmna_0.1.8
uses: progovoy/vmn-action@vmna_0.1.78
with:
release-mode: ${{ github.event.inputs.version_type }}
app-name: qrm_server
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-qrm-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:

- name: Stamp with vmn
id: vmn_version
uses: progovoy/vmn-action@vmna_0.1.8
uses: progovoy/vmn-action@vmna_0.1.78
with:
release-mode: ${{ github.event.inputs.version_type }}
app-name: qrm_server
Expand Down
16 changes: 7 additions & 9 deletions tests/test_q_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1336,11 +1336,11 @@ async def test_get_response_by_request_order_after_tags_rearrange(redis_db_objec
res_1 = Resource(name='res1', type='res_type1', token='old_token1', status=ACTIVE_STATUS, tags=['res_type1'])
res_2 = Resource(name='res2', type='res_type2', token='old_token1', status=ACTIVE_STATUS, tags=['res_type2'])
res_3 = Resource(name='res3', type='res_type3', token='old_token2', status=ACTIVE_STATUS, tags=['res_type3'])

await redis_db_object.add_resource(res_1)
await redis_db_object.add_resource(res_2)
await redis_db_object.add_resource(res_3)


user_request1 = ResourcesRequest(token='token1')
user_request1.add_request_by_names(names=['res1'], count=1)
user_request1.add_request_by_names(names=['res3'], count=1)
Expand All @@ -1352,20 +1352,14 @@ async def test_get_response_by_request_order_after_tags_rearrange(redis_db_objec
user_request2.add_request_by_tags(tags=['res_type2'], count=1)
user_request2.add_request_by_tags(tags=['res_type3'], count=1)

fut2 = asyncio.ensure_future(qrm_backend_with_db.new_request(user_request2))

# res_1 (type1): [token1, token2]
# res_2 (type2): [token2]
# res_3 (type3): [token1, token2]

# token2 should be removed from res_5 and res_6 since it needs only one from them even though that the request
# is not yet completed since token2 is still waiting for resource from type2 (count=2)

fut2 = asyncio.ensure_future(qrm_backend_with_db.new_request(user_request2))

await asyncio.sleep(0.1)

new_jobs_res_2 = await redis_db_object.get_resource_jobs(res_2)
new_jobs_res_3 = await redis_db_object.get_resource_jobs(res_3)

new_token_1 = await qrm_backend_with_db.get_new_token('token1')
await qrm_backend_with_db.cancel_request(new_token_1)

Expand All @@ -1378,3 +1372,7 @@ async def test_get_response_by_request_order_after_tags_rearrange(redis_db_objec
resp_2 = await qrm_backend_with_db.get_resource_req_resp(new_token_2)

assert ['res1', 'res2', 'res3'] == resp_2.names # this is the request order and it must be saved

is_active = await qrm_backend_with_db.is_request_active(token=new_token_2)

assert not is_active

0 comments on commit 534566a

Please sign in to comment.