Skip to content

feat(BA-984): Add Action Tests for Image #4048

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

Merged
merged 21 commits into from
May 28, 2025
Merged

Conversation

jopemachine
Copy link
Member

@jopemachine jopemachine commented Mar 27, 2025

Resolves #3964 (BA-984).

Based on #3997.

Test cases

  • alias_image
  • clear_images
  • dealias_image
  • forget_image
  • forget_image_by_id
  • modify_image
  • purge_image_by_id
  • purge_images
  • rescan_images
  • untag_image_from_registry
  • clear_image_custom_resource_limit

Checklist: (if applicable)

  • Mention to the original issue

@github-actions github-actions bot added the size:XL 500~ LoC label Mar 27, 2025
@jopemachine jopemachine changed the title feat: Add Action Tests for Image feat(BA-984): Add Action Tests for Image Mar 27, 2025
@jopemachine jopemachine force-pushed the refactor/image_action branch from a875b72 to 5969762 Compare March 27, 2025 04:48
@jopemachine jopemachine force-pushed the feat/add_image_action_tests branch from a9d334c to 4582ba7 Compare March 27, 2025 04:49
@jopemachine jopemachine force-pushed the feat/add_image_action_tests branch from 4582ba7 to 3a24196 Compare March 27, 2025 05:01
@jopemachine jopemachine force-pushed the feat/add_image_action_tests branch 2 times, most recently from d1a4f81 to 16090e9 Compare March 31, 2025 02:31
@github-actions github-actions bot added comp:manager Related to Manager component comp:common Related to Common component labels Mar 31, 2025
@jopemachine jopemachine force-pushed the refactor/image_action branch from 2d0f6c7 to d3dc584 Compare March 31, 2025 02:40
@jopemachine jopemachine force-pushed the feat/add_image_action_tests branch from 16090e9 to e99275f Compare March 31, 2025 02:42
@jopemachine jopemachine force-pushed the refactor/image_action branch 5 times, most recently from b090bde to 387fa73 Compare April 4, 2025 11:59
@HyeockJinKim HyeockJinKim force-pushed the refactor/image_action branch from effb5fa to 818b1d0 Compare April 5, 2025 09:08
Base automatically changed from refactor/image_action to main April 5, 2025 09:20
@jopemachine jopemachine force-pushed the feat/add_image_action_tests branch 2 times, most recently from 8314580 to 8cdd6ad Compare April 21, 2025 10:01
@@ -44,6 +44,7 @@
)
if project:
stmt = stmt.where(ContainerRegistryRow.project == project)
# TODO: Raise exception if registry not found or two or more registries found

Check notice

Code scanning / devskim

A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note

Suspicious comment
@jopemachine jopemachine marked this pull request as ready for review April 22, 2025 07:36
@jopemachine jopemachine force-pushed the feat/add_image_action_tests branch from bea6181 to f8da2b9 Compare April 23, 2025 01:16
@@ -301,7 +301,7 @@ async def rescan_images(
# TODO: delete images removed from registry?


type Resources = dict[SlotName, dict[str, Decimal]]
type Resources = dict[SlotName, dict[str, Any]]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason you changed this? @jopemachine

Copy link
Member Author

@jopemachine jopemachine Apr 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a type error in the code below, so I temporarily changed it to Any, but I think it would be better to use int | str or define an appropriate type.

https://github.com/lablup/backend.ai/pull/4048/files#diff-b22639c8c2dcbef7f7b7443c407831448d71c4140036cce9311c13cd59bbb48cR85-R89

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's very strange that it's updated because of the test code, is that correct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that I added an incorrect type in the recent PR I submitted.

Comment on lines +1359 to +1362
if isinstance(col.type, sa.sql.sqltypes.DateTime):
for row in rows:
if col.name in row:
row[col.name] = isoparse(row[col.name])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't there a datetime value acceptor before? Why did you add it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the previous code for populate_fixture, the logic for handling DateTime types was missing, so an error occurs when generating a fixture that includes DateTime columns like ImageRow.created_at.

Comment on lines 190 to +192
)
instance.id = data.id
return instance
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you put the ID value at creation time?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the ID is injected from the database, the ID value passed through the constructor wouldn't be passed to the database, so I intentionally excluded it from the constructor.

Comment on lines +7 to +11
@pytest.fixture
def processors(extra_fixtures, database_fixture, database_engine, registry_ctx):
agent_registry, _, _, _, _, _, _ = registry_ctx
image_service = ImageService(db=database_engine, agent_registry=agent_registry)
return ImageProcessors(image_service, [])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename to image_processors

@jopemachine jopemachine force-pushed the feat/add_image_action_tests branch from 1e471ff to 8aab5fd Compare May 28, 2025 07:19
@jopemachine jopemachine force-pushed the feat/add_image_action_tests branch from b6bb29b to ded5ac5 Compare May 28, 2025 07:46
@HyeockJinKim HyeockJinKim added this pull request to the merge queue May 28, 2025
Merged via the queue into main with commit 646d6a9 May 28, 2025
29 checks passed
@HyeockJinKim HyeockJinKim deleted the feat/add_image_action_tests branch May 28, 2025 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:common Related to Common component comp:manager Related to Manager component size:XL 500~ LoC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Action Test Code for Image
2 participants