Skip to content
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

fix: update get and delete task unit test and e2e test. #3525

Merged
merged 5 commits into from
Sep 23, 2024

Conversation

IRONICBo
Copy link
Contributor

@IRONICBo IRONICBo commented Sep 22, 2024

Description

This PR focuses on improving the unit tests for the manager/job/task.go and rewriting the e2e tests. The key changes are:
Unit Test Rewrite (manager/job/task.go):

  1. The unit tests for CreateGetTask and CreateDeleteTask have been completely rewritten.
  2. The new tests provide more comprehensive coverage, including handling both success and failure cases.
  3. Mocking and assertions have been added to verify internal logic, ensuring the robustness of task creation and deletion workflows.
    End-to-End (e2e) Tests:
  4. New e2e tests have been added, following the structure of existing preheat tests.
  5. The e2e tests now include proper assertions on return values to validate task creation and deletion scenarios.
  6. These tests aim to cover the complete flow from request to response, ensuring that the APIs function as expected in real-world scenarios.

Related Issue

Motivation and Context

The previous unit and e2e tests were either lacking sufficient coverage or not thoroughly validating the expected outcomes. This PR enhances the testing suite by:

Refactoring the unit tests to cover more edge cases.
Introducing e2e tests that assert the correctness of return values and ensure the stability of critical functionalities.
These improvements will help catch bugs earlier and ensure that task creation and deletion APIs behave correctly in both isolated unit tests and integrated environments.

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update (if none of the other choices apply)

Checklist

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

@IRONICBo IRONICBo requested a review from a team as a code owner September 22, 2024 15:14
@IRONICBo IRONICBo changed the title fix: update get and delete task response data. fix: update get and delete task unit test and e2e test. Sep 22, 2024
Copy link

codecov bot commented Sep 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 51.98%. Comparing base (7bcbac9) to head (610c362).
Report is 3 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3525      +/-   ##
==========================================
+ Coverage   51.72%   51.98%   +0.26%     
==========================================
  Files         190      190              
  Lines       20424    20432       +8     
==========================================
+ Hits        10564    10622      +58     
+ Misses       9058     9000      -58     
- Partials      802      810       +8     
Flag Coverage Δ
unittests 51.98% <ø> (+0.26%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 8 files with indirect coverage changes

@IRONICBo IRONICBo requested a review from a team as a code owner September 23, 2024 02:42
@IRONICBo IRONICBo force-pushed the fix/fix-get-and-delete-task-test branch from 3fcb715 to 7b2d609 Compare September 23, 2024 03:09
@IRONICBo IRONICBo force-pushed the fix/fix-get-and-delete-task-test branch from 7b2d609 to ac2ae76 Compare September 23, 2024 03:32
Copy link
Member

@gaius-qi gaius-qi left a comment

Choose a reason for hiding this comment

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

Add failed case.

@IRONICBo IRONICBo force-pushed the fix/fix-get-and-delete-task-test branch from 1f3b015 to 3f56293 Compare September 23, 2024 10:59
@IRONICBo IRONICBo force-pushed the fix/fix-get-and-delete-task-test branch from 3f56293 to 6bc9e20 Compare September 23, 2024 11:01
@IRONICBo IRONICBo requested a review from gaius-qi September 23, 2024 11:42
manager/job/task_test.go Outdated Show resolved Hide resolved
manager/job/task_test.go Outdated Show resolved Hide resolved
manager/job/task_test.go Outdated Show resolved Hide resolved
test/e2e/v2/manager/task.go Outdated Show resolved Hide resolved
@IRONICBo IRONICBo requested a review from gaius-qi September 23, 2024 13:10
Copy link
Member

@gaius-qi gaius-qi left a comment

Choose a reason for hiding this comment

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

LGTM

@gaius-qi gaius-qi merged commit 80717c7 into dragonflyoss:main Sep 23, 2024
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants