-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Runtimes] Add validation on inputs types (#1550)
- Loading branch information
1 parent
c187e5c
commit 3f11240
Showing
5 changed files
with
116 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import pytest | ||
from fastapi.testclient import TestClient | ||
from sqlalchemy.orm import Session | ||
|
||
import mlrun.errors | ||
from mlrun.runtimes.base import BaseRuntime | ||
from tests.api.runtimes.base import TestRuntimeBase | ||
|
||
|
||
class TestBaseRunTime(TestRuntimeBase): | ||
def custom_setup_after_fixtures(self): | ||
self._mock_create_namespaced_pod() | ||
|
||
@pytest.mark.parametrize( | ||
"inputs", [{"input1": 123}, {"input1": None}, {"input1": None, "input2": 2}] | ||
) | ||
def test_run_with_invalid_inputs(self, db: Session, client: TestClient, inputs): | ||
runtime = BaseRuntime() | ||
with pytest.raises(mlrun.errors.MLRunInvalidArgumentTypeError): | ||
self._execute_run(runtime, inputs=inputs) | ||
|
||
def test_run_with_valid_inputs(self, db: Session, client: TestClient): | ||
inputs = {"input1": "mlrun"} | ||
runtime = BaseRuntime() | ||
self._execute_run(runtime, inputs=inputs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters