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

[mesheryctl] Create Unit and Integration Tests for mesheryctl model import Command #12137

Open
Aijeyomah opened this issue Sep 26, 2024 · 10 comments · May be fixed by #13177
Open

[mesheryctl] Create Unit and Integration Tests for mesheryctl model import Command #12137

Aijeyomah opened this issue Sep 26, 2024 · 10 comments · May be fixed by #13177
Assignees
Labels
component/mesheryctl CLI for Meshery good first issue Good for newcomers hacktoberfest Happy contributing! help wanted Extra attention is needed kind/enhancement Improvement in current feature language/go Issues or pull requests that use Golang

Comments

@Aijeyomah
Copy link
Contributor

Description

We need to develop comprehensive unit and integration tests for the mesheryctl model import command. This command handles importing models from both individual files and directories, compressing the data if necessary, and sending it to the Meshery server for processing.

The goal is to ensure that the import model command functions as expected, handles errors appropriately, and interacts with the Meshery server correctly.

Current Behavior

Currently, there are no automated tests for the mesheryctl model import command, which imports models in various formats such as .yaml, .json, .tar.gz, and .zip from files and directories. The command checks the input, compresses directories, and sends the data to the Meshery API for model registration.

Desired Behavior

Tests should cover the following aspects:

  1. File and Directory Handling:

    • Verify that the command correctly identifies and processes individual model files (.yaml, .json).
    • Verify that directories are correctly compressed and handled.
    • Ensure proper error handling for invalid file formats and paths.
  2. API Interaction:

    • Mock the Meshery server to test that the API endpoint /api/meshmodels/register is properly called and responds correctly.
    • Ensure the correct HTTP method, headers, and payload are sent.
    • Handle error cases such as failed network requests or non-200 responses from the server.
  3. Error Handling:

    • Ensure that missing or unreadable files and directories are handled with proper error messages.
    • Test for unsupported file formats and ensure the user is notified of invalid input.
    • Ensure that server-side errors (e.g., failed registrations) are appropriately handled.

Resources


Contributor Resources

@Aijeyomah Aijeyomah added kind/enhancement Improvement in current feature component/mesheryctl CLI for Meshery language/go Issues or pull requests that use Golang good first issue Good for newcomers hacktoberfest Happy contributing! labels Sep 26, 2024
Copy link

This issue has been labeled with 'component/mesheryctl'. Note that after making changes you need to update it in the mesheryctl command tracker spreadsheet.


        Be sure to join the community, if you haven't yet and please leave a ⭐ star on the project 😄

@Jash2606
Copy link

Hi @leecalcote, I'd like to contribute to this issue. Could you please assign it to me?

@TraXIcoN
Copy link
Contributor

Hi, I'd like to take on this issue. I have experience with unit testing in Python and some with Go. I've been going through the project since the newcomer's meeting and feel confident I can do this. Please assign it to me!

Thanks!

@leecalcote leecalcote added the help wanted Extra attention is needed label Sep 27, 2024
@lekaf974 lekaf974 changed the title Create Unit and Integration Tests for mesheryctl model import Command [mesheryctl] Create Unit and Integration Tests for mesheryctl model import Command Sep 28, 2024
@lekaf974
Copy link
Contributor

@Jash2606 still interested ?

@lekaf974 lekaf974 self-assigned this Oct 1, 2024
@prachinandi
Copy link

I can take this work!

@lekaf974
Copy link
Contributor

lekaf974 commented Oct 4, 2024

@prachinandi I have already started to work on this one

Copy link

stale bot commented Nov 17, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the issue/stale Issue has not had any activity for an extended period of time label Nov 17, 2024
@AdiAkhileshSingh15
Copy link

AdiAkhileshSingh15 commented Dec 29, 2024

what's the progress on this issue? is someone onto it?
i can see that some refactoring of the code has taken place in the import.go file, which are not mentioned here, some other pr does that.
we still don't have the tests for model import. so, if someone allows me to take this up and give it a try, i'd be happy to help. also @lekaf974 if you can tell me why was the last pr closed?

@stale stale bot removed the issue/stale Issue has not had any activity for an extended period of time label Dec 29, 2024
@lekaf974
Copy link
Contributor

@AdiAkhileshSingh15 my PR was opened for a while and lot of changes were made so I closed the PR. It can be yours if you want

@AdiAkhileshSingh15
Copy link

sure @lekaf974! thanks.

@AdiAkhileshSingh15 AdiAkhileshSingh15 linked a pull request Jan 8, 2025 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/mesheryctl CLI for Meshery good first issue Good for newcomers hacktoberfest Happy contributing! help wanted Extra attention is needed kind/enhancement Improvement in current feature language/go Issues or pull requests that use Golang
Projects
None yet
7 participants