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

[API] Fix artifact storing without project in body #1608

Conversation

Tankilevitch
Copy link
Contributor

@Tankilevitch Tankilevitch commented Jan 4, 2022

@@ -55,3 +55,37 @@ def test_list_artifacts_filter_by_kind(self):
project=prj, category=mlrun.api.schemas.ArtifactCategories.dataset
)
assert len(artifacts) == 1, "bad number of dataset artifacts"

def test_store_artifact_with_empty_dict(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

We should always strive for having a functionality being tested by the fastest possible test:

  • System tests are the slowest one - in order to run a test correctly you need to build a whole version out of the code, transplant it in the system etc..
  • Integration tests are faster - in order to run a test you (done automatically when you run it) build a docker image of the API, run it, and do actions in the client
  • Unit tests are the fastest - all you need to run them is to install all requirements

Your change here is in the API code, client is irrelevant, therefore the correct place IMO to test it is the API tests, which are unit tests that bring up a mock API inside the test process

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So you suggesting removing those tests?

Comment on lines +27 to +28
if not data.setdefault("project", project):
data["project"] = project
Copy link
Contributor

Choose a reason for hiding this comment

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

If you handled the case of an empty string, I suggest that you'll cover it in the tests (maybe I missed it ?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added unittests

@Hedingber Hedingber changed the title [ARTIFACTS] Fix artifact storing without project in body [API] Fix artifact storing without project in body Jan 6, 2022
@Hedingber
Copy link
Contributor

I meant that you'll remove the integration tests, other than that LGTM

@Hedingber Hedingber merged commit 36e26e9 into mlrun:development Jan 8, 2022
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.

None yet

2 participants