Skip to content

Commit

Permalink
sample-collection, limit list-releases to 5000 items (#9407)
Browse files Browse the repository at this point in the history
  • Loading branch information
weidongxu-microsoft authored Nov 20, 2024
1 parent 1717d7b commit 3d29ed3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ def process_sdk(operation: OperationConfiguration, sdk: SdkConfiguration, report

logging.info(f"Processing sdk: {sdk.name}")
count = 0
max_count = 5000
releases: List[Release] = []
repo = GitHubRepository(sdk.repository_owner, sdk.repository_name, github_token)
# since there is no ordering from GitHub, just get all releases (exclude draft=True), and hope paging is correct
Expand All @@ -283,6 +284,9 @@ def process_sdk(operation: OperationConfiguration, sdk: SdkConfiguration, report
release = Release(release_tag, package, version, published_at)
releases.append(release)
logging.info(f"Found release tag: {release.tag}")
if count > max_count:
# typically we only need releases from recent 10 days, abort before hit GitHub rate limit
break
except Exception as e:
report.aggregated_error.errors.append(e)
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from main import break_down_aggregated_dotnet_example, format_dotnet, get_dotnet_using_statements
from typing import List


class TestMain(unittest.TestCase):
@parameterized.parameterized.expand(
[
Expand Down Expand Up @@ -378,12 +379,12 @@ def test_break_down_aggregated_dotnet_example(self, file_content: str):
"using Azure.ResourceManager.Compute.Models;\n",
"using Azure.ResourceManager.Resources;\n",
"using Azure.ResourceManager.Resources.Models;\n",
]
],
)
]
)
def test_example_usings(self, content: str, expected_usings: List[str]):
lines = content.splitlines(keepends=True)
usings = get_dotnet_using_statements(lines)

self.assertSetEqual(set(expected_usings), set(usings))

0 comments on commit 3d29ed3

Please sign in to comment.