[ServiceBus] don't yield empty page when listing rules in RuleManager (#22159)

We should stop when there's no more returned rules. I did this previously
probably to support continuationToken as we have to make the last request to
know that there are no more results, and we then set continuationToken to
undefined on this empty page.  Now that the continuationToken is removed, we can
stop yielding empty page.
This commit is contained in:
Jeremy Meng 2022-06-09 10:09:04 -07:00 коммит произвёл GitHub
Родитель d6c33967b1
Коммит 79bb5b3bc7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 3 добавлений и 5 удалений

Просмотреть файл

@ -10,6 +10,8 @@
### Other Changes
- Stop yielding empty page when listing rules using RuleManager.
## 7.6.0-beta.4 (2022-06-07)
### Features Added

Просмотреть файл

@ -193,8 +193,8 @@ export class ServiceBusRuleManagerImpl implements ServiceBusRuleManager {
maxCount: options.maxPageSize ?? 100,
...options,
});
yield rules;
if (rules.length > 0) {
yield rules;
marker = String(Number(marker ?? 0) + rules.length);
} else {
break;

Просмотреть файл

@ -232,8 +232,6 @@ describe("RuleManager tests", () => {
assert.equal(result.value.length, 1, "Expecting one rule in third page");
assert.equal(result.value[0].name, sqlRuleName);
result = await iterator.next();
assert.equal(result.value.length, 0, "Not expecting any result in last page");
result = await iterator.next();
assert.equal(result.value, undefined, "Not expecting any more pages");
});
@ -274,8 +272,6 @@ describe("RuleManager tests", () => {
let result = await iterator.next();
assert.equal(result.value.length, 3, "Expecting one rule in first page");
result = await iterator.next();
assert.equal(result.value.length, 0, "Not expecting any result in last page");
result = await iterator.next();
assert.equal(result.value, undefined, "Not expecting any more pages");
});