-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Don't skip last index during iteration. #18996
base: master
Are you sure you want to change the base?
Conversation
Last empty element is removed on line 358 in `get_info` func
0655e3c
to
88ad789
Compare
@voyvodov thanks for your contribution! Could you please add a unit test for it? lmk if I can help with that. |
Thanks @iliakur ! If you can help with the unit tests that will be great. I'm trying to at least add indexes to the e2e tests, but if we can do it in unit too, that will be great. def collect_sindex(self, namespaces, namespace_tags):
for ns in namespaces:
# https://www.aerospike.com/docs/reference/info/#sindex
sindex = self.get_info('sindex/{}'.format(ns))
for idx in parse_namespace(sindex, ns, 'indexname'):
sindex_tags = ['sindex:{}'.format(idx)]
sindex_tags.extend(namespace_tags)
self.collect_info('sindex/{}/{}'.format(ns, idx), SINDEX_METRIC_TYPE, tags=sindex_tags) |
d2cdc1e
to
194c9e5
Compare
@iliakur I think I found a way to do it correctly, without touching base code. Can you check? |
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.
Thanks for this!
Left a few suggestions to clean things up, otherwise lgtm!!
aerospike/tests/test_unit.py
Outdated
return common.MOCK_INDEXES_METRICS | ||
elif command.startswith("sets/"): | ||
return [] | ||
print(f'got {command}') |
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.
print(f'got {command}') |
aerospike/tests/test_unit.py
Outdated
"ns=test:indexname=idx_characters_name:set=characters:bin=name:type=string:indextype=default:context=null:state=RW" | ||
] | ||
elif command == "sindex/test/idx_characters_name": | ||
print(f"got get index info. Returning {common.MOCK_INDEXES_METRICS}") |
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.
print(f"got get index info. Returning {common.MOCK_INDEXES_METRICS}") |
aerospike/tests/test_unit.py
Outdated
check._tags = [] | ||
check._client = mock.MagicMock() | ||
check._client.get_node_names = mock.MagicMock( | ||
side_effect=lambda: [{'address': common.HOST, 'port': common.PORT, 'node_name': 'test'}] |
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.
side_effect=lambda: [{'address': common.HOST, 'port': common.PORT, 'node_name': 'test'}] | |
return_value={'address': common.HOST, 'port': common.PORT, 'node_name': 'test'} |
aerospike/tests/test_unit.py
Outdated
side_effect=lambda: [{'address': common.HOST, 'port': common.PORT, 'node_name': 'test'}] | ||
) | ||
check.get_namespaces = mock.MagicMock(return_value=['test']) | ||
# check.collect_info = mock.MagicMock() |
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.
# check.collect_info = mock.MagicMock() |
Oh my....Didn't notice that I commit all the "debug" prints there 🤦🏽 . Sorry, all fixed. |
Last empty element is removed on line 358 in
get_info
funcWhat does this PR do?
Fixing #18995
Motivation
We're missing information for the last index in every namespace
Review checklist (to be filled by reviewers)
qa/skip-qa
label if the PR doesn't need to be tested during QA.backport/<branch-name>
label to the PR and it will automatically open a backport PR once this one is merged