Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[API] Ensure project on function deployment (#1251)
- Loading branch information
Showing
6 changed files
with
51 additions
and
4 deletions.
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
Empty file.
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,9 @@ | ||
def handler(context, event): | ||
context.logger.info("Hello world") | ||
|
||
return context.Response( | ||
body="Hello, from nuclio :]", | ||
headers={}, | ||
content_type="text/plain", | ||
status_code=200, | ||
) |
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,27 @@ | ||
import mlrun | ||
import tests.system.base | ||
|
||
|
||
@tests.system.base.TestMLRunSystem.skip_test_if_env_not_configured | ||
class TestNuclioRuntime(tests.system.base.TestMLRunSystem): | ||
|
||
project_name = "does-not-exist-3" | ||
|
||
@staticmethod | ||
def _skip_set_environment(): | ||
# Skip to make sure project ensured in Nuclio function deployment flow | ||
return True | ||
|
||
def test_deploy_function_without_project(self): | ||
code_path = str(self.assets_path / "nuclio_function.py") | ||
|
||
self._logger.debug("Creating nuclio function") | ||
function = mlrun.code_to_function( | ||
name="simple-function", | ||
kind="nuclio", | ||
project=self.project_name, | ||
filename=code_path, | ||
) | ||
|
||
self._logger.debug("Deploying nuclio function") | ||
function.deploy() |