Skip to content

Commit a1d4579

Browse files
version chooser: test tag fetching
1 parent 8ddd583 commit a1d4579

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

core/services/versionchooser/test_versionchooser.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import pytest
77

88
from utils.chooser import VersionChooser
9+
from utils.dockerhub import TagFetcher, TagMetadata
910

1011
# All test coroutines will be treated as marked.
1112
pytestmark = pytest.mark.asyncio
@@ -236,3 +237,41 @@ async def is_valid_version(image: str) -> Tuple[bool, str]:
236237
result = await chooser.set_version("bluerobotics/blueos-core", "master")
237238
assert result.status_code == 500
238239
assert len(json_mock.mock_calls) > 0
240+
241+
242+
class TestTagFetcher:
243+
"""Test class for TagFetcher functionality"""
244+
245+
@pytest.mark.asyncio
246+
async def test_fetch_real_blueos_core_tags(self) -> None:
247+
"""Integration test: Fetch real tags from bluerobotics/blueos-core repository"""
248+
fetcher = TagFetcher()
249+
250+
try:
251+
errors, tags = await fetcher.fetch_remote_tags("bluerobotics/blueos-core", [])
252+
253+
# Verify we got some tags back
254+
assert isinstance(tags, list)
255+
assert len(tags) > 0, "Should have found some tags for bluerobotics/blueos-core"
256+
257+
# Verify tag structure
258+
for tag in tags[:3]: # Check first 3 tags
259+
assert isinstance(tag, TagMetadata)
260+
assert tag.repository == "bluerobotics/blueos-core"
261+
assert tag.image == "blueos-core"
262+
assert tag.tag is not None
263+
assert len(tag.tag) > 0
264+
assert tag.last_modified is not None
265+
assert tag.digest is not None
266+
267+
# Should find the 'master' tag
268+
tag_names = [tag.tag for tag in tags]
269+
assert "master" in tag_names, f"Expected to find 'master' tag in tags: {tag_names[:10]}"
270+
271+
# Errors should be empty string if successful
272+
if errors:
273+
print(f"Non-fatal errors during fetch: {errors}")
274+
275+
except Exception as e:
276+
# If this fails due to network issues, skip the test
277+
pytest.skip(f"Could not fetch tags from DockerHub, likely network issue: {e}")

0 commit comments

Comments
 (0)