From 6cf5dc085b56899a5cacd4e86355c747e86920ae Mon Sep 17 00:00:00 2001 From: jeff ngo Date: Thu, 12 Mar 2020 15:37:45 -0700 Subject: [PATCH] PYT-1103 No error displayed by the dvp upload command when file upload job fails --- .bumpversion.cfg | 2 +- .../python/dlpx/virtualization/common/VERSION | 2 +- .../main/python/dlpx/virtualization/VERSION | 2 +- .../python/dlpx/virtualization/libs/VERSION | 2 +- .../dlpx/virtualization/platform/VERSION | 2 +- .../dlpx/virtualization/_internal/VERSION | 2 +- .../dlpx/virtualization/_internal/cli.py | 7 +- .../_internal/commands/upload.py | 9 +- .../_internal/delphix_client.py | 69 +++++++++- .../virtualization/_internal/exceptions.py | 24 ++++ .../_internal/commands/test_build.py | 15 +-- .../_internal/commands/test_delphix_client.py | 123 +++++++++++++++++- .../_internal/commands/test_upload.py | 19 ++- .../dlpx/virtualization/_internal/test_cli.py | 10 +- .../_internal/test_package_util.py | 2 +- .../_internal/test_plugin_importer.py | 1 - 16 files changed, 248 insertions(+), 43 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index b447cbc3..67fb44d8 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 2.0.0-internal-001 +current_version = 2.0.0-internal-2 commit = False tag = False parse = (?P\d+)\.(?P\d+)\.(?P\d+)(\-(?P[a-z]+)\-(?P\d+))? diff --git a/common/src/main/python/dlpx/virtualization/common/VERSION b/common/src/main/python/dlpx/virtualization/common/VERSION index 817c47e6..62178d2d 100644 --- a/common/src/main/python/dlpx/virtualization/common/VERSION +++ b/common/src/main/python/dlpx/virtualization/common/VERSION @@ -1 +1 @@ -2.0.0-internal-001 \ No newline at end of file +2.0.0-internal-2 \ No newline at end of file diff --git a/dvp/src/main/python/dlpx/virtualization/VERSION b/dvp/src/main/python/dlpx/virtualization/VERSION index 817c47e6..62178d2d 100644 --- a/dvp/src/main/python/dlpx/virtualization/VERSION +++ b/dvp/src/main/python/dlpx/virtualization/VERSION @@ -1 +1 @@ -2.0.0-internal-001 \ No newline at end of file +2.0.0-internal-2 \ No newline at end of file diff --git a/libs/src/main/python/dlpx/virtualization/libs/VERSION b/libs/src/main/python/dlpx/virtualization/libs/VERSION index 817c47e6..62178d2d 100644 --- a/libs/src/main/python/dlpx/virtualization/libs/VERSION +++ b/libs/src/main/python/dlpx/virtualization/libs/VERSION @@ -1 +1 @@ -2.0.0-internal-001 \ No newline at end of file +2.0.0-internal-2 \ No newline at end of file diff --git a/platform/src/main/python/dlpx/virtualization/platform/VERSION b/platform/src/main/python/dlpx/virtualization/platform/VERSION index 817c47e6..62178d2d 100644 --- a/platform/src/main/python/dlpx/virtualization/platform/VERSION +++ b/platform/src/main/python/dlpx/virtualization/platform/VERSION @@ -1 +1 @@ -2.0.0-internal-001 \ No newline at end of file +2.0.0-internal-2 \ No newline at end of file diff --git a/tools/src/main/python/dlpx/virtualization/_internal/VERSION b/tools/src/main/python/dlpx/virtualization/_internal/VERSION index 817c47e6..62178d2d 100644 --- a/tools/src/main/python/dlpx/virtualization/_internal/VERSION +++ b/tools/src/main/python/dlpx/virtualization/_internal/VERSION @@ -1 +1 @@ -2.0.0-internal-001 \ No newline at end of file +2.0.0-internal-2 \ No newline at end of file diff --git a/tools/src/main/python/dlpx/virtualization/_internal/cli.py b/tools/src/main/python/dlpx/virtualization/_internal/cli.py index a71c6343..6d0cc3af 100644 --- a/tools/src/main/python/dlpx/virtualization/_internal/cli.py +++ b/tools/src/main/python/dlpx/virtualization/_internal/cli.py @@ -240,11 +240,14 @@ def build(plugin_config, upload_artifact, generate_only, skip_id_validation, resolve_path=True), callback=click_util.validate_option_exists, help='Path to the upload artifact that was generated through build.') +@click.option('--wait', + is_flag=True, + help='Wait for the upload job to complete before returning.') @click.password_option(cls=click_util.PasswordPromptIf, default=DVP_CONFIG_MAP.get('password'), confirmation_prompt=False, help='Authenticate using the provided password.') -def upload(engine, user, upload_artifact, password): +def upload(engine, user, upload_artifact, password, wait): """ Upload the generated upload artifact (the plugin JSON file) that was built to a target Delphix Engine. @@ -252,7 +255,7 @@ def upload(engine, user, upload_artifact, password): the build command and will fail if it's not readable or valid. """ with command_error_handler(): - upload_internal.upload(engine, user, upload_artifact, password) + upload_internal.upload(engine, user, upload_artifact, password, wait) @delphix_sdk.command() diff --git a/tools/src/main/python/dlpx/virtualization/_internal/commands/upload.py b/tools/src/main/python/dlpx/virtualization/_internal/commands/upload.py index 7cb79215..1395f4ae 100644 --- a/tools/src/main/python/dlpx/virtualization/_internal/commands/upload.py +++ b/tools/src/main/python/dlpx/virtualization/_internal/commands/upload.py @@ -13,7 +13,7 @@ UNKNOWN_ERR = 'UNKNOWN_ERR' -def upload(engine, user, upload_artifact, password): +def upload(engine, user, upload_artifact, password, wait): """ Takes in the engine hostname/ip address, logs on and uploads the artifact passed in. The upload artifact should have been generated via the build @@ -26,11 +26,14 @@ def upload(engine, user, upload_artifact, password): InvalidArtifactError HttpError UnexpectedError + PluginUploadJobFailed + PluginUploadWaitTimedOut """ logger.debug('Upload parameters include' ' engine: {},' ' user: {},' - ' upload_artifact: {}'.format(engine, user, upload_artifact)) + ' upload_artifact: {},' + ' wait: {}'.format(engine, user, upload_artifact, wait)) logger.info('Uploading plugin artifact {} ...'.format(upload_artifact)) # Read content of upload artifact @@ -54,4 +57,4 @@ def upload(engine, user, upload_artifact, password): client = delphix_client.DelphixClient(engine) engine_api = client.get_engine_api(content) client.login(engine_api, user, password) - client.upload_plugin(os.path.basename(upload_artifact), content) + client.upload_plugin(os.path.basename(upload_artifact), content, wait) diff --git a/tools/src/main/python/dlpx/virtualization/_internal/delphix_client.py b/tools/src/main/python/dlpx/virtualization/_internal/delphix_client.py index f2699bf6..2ab521fa 100644 --- a/tools/src/main/python/dlpx/virtualization/_internal/delphix_client.py +++ b/tools/src/main/python/dlpx/virtualization/_internal/delphix_client.py @@ -4,6 +4,8 @@ import json import logging +import threading +import time import requests from dlpx.virtualization._internal import exceptions, plugin_util @@ -20,10 +22,14 @@ class DelphixClient(object): """ __BOUNDARY = '----------boundary------' __UPLOAD_CONTENT = 'multipart/form-data; boundary={}'.format(__BOUNDARY) + __JOB_POLLING_INTERVAL = 5 + __WAIT_TIMEOUT_SECONDS = 3600 __cookie = None - def __init__(self, engine): + def __init__(self, engine, timeout=None): self.__engine = engine + if timeout is not None: + self.__WAIT_TIMEOUT_SECONDS = timeout def login(self, engine_api, user, password): """ @@ -207,13 +213,12 @@ def __download_logs(self, plugin_name, token, directory): for chunk in download_zip_data: f.write(chunk) - def upload_plugin(self, name, content): + def upload_plugin(self, name, content, wait): """ Takes in the plugin name and content (as a json). Attempts to upload the plugin onto the connected Delphix Engine. Can raise HttpPostError and UnexpectedError. """ - # Get the upload token. logger.debug('Getting token to do upload.') response = self.__post('delphix/toolkit/requestUploadToken') @@ -222,10 +227,60 @@ def upload_plugin(self, name, content): logger.info('Uploading plugin {!r}.'.format(name)) # Encode plugin content. - self.__post('delphix/data/upload', - content_type=self.__UPLOAD_CONTENT, - data=self.__encode(json.dumps(content), token, name)) - logger.info('Plugin was successfully uploaded.') + upload_response = self.__post('delphix/data/upload', + content_type=self.__UPLOAD_CONTENT, + data=self.__encode( + json.dumps(content), token, name)) + if wait: + self._wait_for_upload_to_complete(name, + upload_response.get('action'), + upload_response.get('job')) + + def _wait_for_upload_to_complete(self, name, upload_action, upgrade_job): + """ + Waits a maximum of 60 minutes for the plugin upload to complete before + returning from the cli command. If the upload response contains a job, + this means that the plugin will be upgraded. We log additional details + regarding events if the job exists (i.e. event code, details, and + action), but only if we haven't seen the job event before. We will + return when the job succeeds, fails, or times out. Can raise + PluginUploadJobFailed or PluginUploadWaitTimedOut + """ + ticker = threading.Event() + start_time = time.time() + event_tuples = set() + failed_statuses = ('FAILED', 'SUSPENDED', 'CANCELLED') + while not ticker.wait(self.__JOB_POLLING_INTERVAL): + if upgrade_job: + status_response = self.__get( + 'delphix/action/{}/getJob'.format(upload_action)).json() + events = status_response.get('result').get('events') + for event in events: + event_tuple = (event.get('timestamp'), + event.get('messageCode')) + if event_tuple not in event_tuples: + logger.info('Timestamp: {}, Code: {}'.format( + event.get('timestamp'), event.get('messageCode'))) + logger.warn(event.get('messageDetails')) + if event.get('messageAction') is not None: + logger.warn(event.get('messageAction')) + event_tuples.add(event_tuple) + status = status_response.get('result').get('jobState') + else: + status_response = self.__get( + 'delphix/action/{}'.format(upload_action)).json() + status = status_response.get('result').get('state') + + if status == 'COMPLETED': + logger.warn( + 'Plugin {} was successfully uploaded.'.format(name)) + ticker.set() + elif status in failed_statuses: + ticker.set() + raise exceptions.PluginUploadJobFailed(name) + elif (time.time() - start_time) > self.__WAIT_TIMEOUT_SECONDS: + ticker.set() + raise exceptions.PluginUploadWaitTimedOut(name) def download_plugin_logs(self, directory, plugin_config): """ diff --git a/tools/src/main/python/dlpx/virtualization/_internal/exceptions.py b/tools/src/main/python/dlpx/virtualization/_internal/exceptions.py index bb1e5f47..5013e2d5 100644 --- a/tools/src/main/python/dlpx/virtualization/_internal/exceptions.py +++ b/tools/src/main/python/dlpx/virtualization/_internal/exceptions.py @@ -36,6 +36,30 @@ def __init__(self, message): super(UserError, self).__init__(message) +class PluginUploadJobFailed(UserError): + """ + PluginUploadJobFailed is raised in the upload command if the action/job + that is being monitored returns with a status other than 'COMPLETED' or + 'RUNNING'. + """ + def __init__(self, plugin_name): + message = "Failed trying to upload plugin {}."\ + .format(plugin_name) + super(PluginUploadJobFailed, self).__init__(message) + + +class PluginUploadWaitTimedOut(UserError): + """ + PluginUploadWaitTimedOut is raised in the upload command if the + action/job that is being monitored does not complete or fail within a + 30 minute timeout window. + """ + def __init__(self, plugin): + message = "Timed out waiting for upload of plugin {} to complete."\ + .format(plugin) + super(PluginUploadWaitTimedOut, self).__init__(message) + + class PathIsAbsoluteError(UserError): def __init__(self, path): self.path = path diff --git a/tools/src/test/python/dlpx/virtualization/_internal/commands/test_build.py b/tools/src/test/python/dlpx/virtualization/_internal/commands/test_build.py index 64939dca..7e4271b1 100644 --- a/tools/src/test/python/dlpx/virtualization/_internal/commands/test_build.py +++ b/tools/src/test/python/dlpx/virtualization/_internal/commands/test_build.py @@ -66,9 +66,9 @@ def test_build_success(mock_relative_path, mock_install_deps, 'dlpx.virtualization._internal.plugin_dependency_util.install_deps') @mock.patch('os.path.isabs', return_value=False) def test_build_success_non_default_output_file( - mock_relative_path, mock_install_deps, mock_generate_python, - mock_import_plugin, plugin_config_file, artifact_file, - artifact_content, codegen_gen_py_inputs): + mock_relative_path, mock_install_deps, mock_generate_python, + mock_import_plugin, plugin_config_file, artifact_file, + artifact_content, codegen_gen_py_inputs): gen_py = codegen_gen_py_inputs # Before running build assert that the artifact file does not exist. @@ -217,9 +217,9 @@ def test_build_prepare_artifact_fail(mock_relative_path, mock_install_deps, 'dlpx.virtualization._internal.plugin_dependency_util.install_deps') @mock.patch('os.path.isabs', return_value=False) def test_build_generate_artifact_fail( - mock_relative_path, mock_install_deps, mock_generate_python, - mock_plugin_manifest, mock_gen_artifact, plugin_config_file, - artifact_file, codegen_gen_py_inputs): + mock_relative_path, mock_install_deps, mock_generate_python, + mock_plugin_manifest, mock_gen_artifact, plugin_config_file, + artifact_file, codegen_gen_py_inputs): gen_py = codegen_gen_py_inputs # Before running build assert that the artifact file does not exist. @@ -320,8 +320,7 @@ def test_zip_and_encode_source_files_invalid_dir(src_dir): @staticmethod @mock.patch('compileall.compile_dir') - def test_zip_and_encode_source_files_compileall_fail( - mock_compile, src_dir): + def test_zip_and_encode_source_files_compileall_fail(mock_compile, src_dir): mock_compile.return_value = 0 with pytest.raises(exceptions.UserError) as err_info: build.zip_and_encode_source_files(src_dir) diff --git a/tools/src/test/python/dlpx/virtualization/_internal/commands/test_delphix_client.py b/tools/src/test/python/dlpx/virtualization/_internal/commands/test_delphix_client.py index 4b6b154c..d663e7c3 100644 --- a/tools/src/test/python/dlpx/virtualization/_internal/commands/test_delphix_client.py +++ b/tools/src/test/python/dlpx/virtualization/_internal/commands/test_delphix_client.py @@ -222,6 +222,30 @@ def httpretty_enabled(): 'Date': 'Mon, 04 Feb 2019 08:09:44 GMT' }) + JOB_RESP_FAIL = (('{"type": "OKResult", "status": "OK", "result": ' + '{"jobState": "FAILED", "events": []}}'), { + 'X-Frame-Options': 'SAMEORIGIN', + 'X-Content-Type-Options': 'nosniff', + 'X-XSS-Protection': '1; mode=block', + 'Cache-Control': 'max-age=0', + 'Expires': 'Mon, 04 Feb 2019 23:12:00 GMT', + 'Content-Type': 'application/json', + 'Content-Length': '71', + 'Date': 'Mon, 09 Mar 2020 12:09:27 GMT' + }) + + JOB_RESP_TIMED_OUT = (('{"type": "OKResult", "status": "OK", "result": ' + '{"jobState": "RUNNING", "events": []}}'), { + 'X-Frame-Options': 'SAMEORIGIN', + 'X-Content-Type-Options': 'nosniff', + 'X-XSS-Protection': '1; mode=block', + 'Cache-Control': 'max-age=0', + 'Expires': 'Mon, 04 Feb 2019 23:12:00 GMT', + 'Content-Type': 'application/json', + 'Content-Length': '71', + 'Date': 'Mon, 09 Mar 2020 12:09:27 GMT' + }) + PLUGIN_RESP_SUCCESS = ( '{"type": "ListResult", "status": "OK", "result": [' '{"type": "Toolkit", "reference": "APPDATA_TOOLKIT-1",' @@ -289,7 +313,7 @@ def test_delphix_client_upload_success(engine_api, artifact_content): dc = delphix_client.DelphixClient('test-engine.com') dc.login(engine_api, 'admin', 'delphix') - dc.upload_plugin('plugin name', artifact_content) + dc.upload_plugin('plugin name', artifact_content, False) history = httpretty.HTTPretty.latest_requests assert history[-1].path == u'/resources/json/delphix/data/upload' @@ -490,7 +514,7 @@ def test_delphix_client_get_token_fail(engine_api, artifact_content): dc.login(engine_api, 'admin', 'delphix') with pytest.raises(exceptions.UnexpectedError) as err_info: - dc.upload_plugin('plugin name', artifact_content) + dc.upload_plugin('plugin name', artifact_content, False) assert err_info.value.status_code == 403 assert err_info.value.response == token_body @@ -538,7 +562,7 @@ def test_delphix_client_upload_fail(engine_api, artifact_content): dc.login(engine_api, 'admin', 'delphix') with pytest.raises(exceptions.HttpError) as err_info: - dc.upload_plugin('plugin name', artifact_content) + dc.upload_plugin('plugin name', artifact_content, False) error = err_info.value.error message = err_info.value.message assert err_info.value.status_code == 200 @@ -566,6 +590,99 @@ def test_delphix_client_upload_fail(engine_api, artifact_content): assert history[-3].path == u'/resources/json/delphix/login' assert history[-4].path == u'/resources/json/delphix/session' + @staticmethod + def test_delphix_client_wait_for_job_to_complete_job_failed( + engine_api, artifact_content): + session_body, session_header = TestDelphixClient.SES_RESP_SUCCESS + httpretty.register_uri( + httpretty.POST, + 'http://test-engine.com/resources/json/delphix/session', + body=session_body, + forcing_headers=session_header) + + login_body, login_header = TestDelphixClient.LOGIN_RESP_SUCCESS + httpretty.register_uri( + httpretty.POST, + 'http://test-engine.com/resources/json/delphix/login', + body=login_body, + forcing_headers=login_header) + + token_body, token_header = TestDelphixClient.TOKEN_RESP_SUCCESS + httpretty.register_uri(httpretty.POST, + 'http://test-engine.com/resources/' + 'json/delphix/toolkit/requestUploadToken', + body=token_body, + forcing_headers=token_header) + + job_body, job_header = TestDelphixClient.JOB_RESP_FAIL + httpretty.register_uri(httpretty.GET, + 'http://test-engine.com/resources/json/' + 'delphix/action/ACTION-161/getJob', + body=job_body) + + dc = delphix_client.DelphixClient('test-engine.com') + dc.login(engine_api, 'admin', 'delphix') + + with pytest.raises(exceptions.PluginUploadJobFailed) as err_info: + dc._wait_for_upload_to_complete('nix_direct_python', 'ACTION-161', + 'JOB-38') + + assert err_info.value.message == ('Failed trying to upload plugin ' + 'nix_direct_python.') + + history = httpretty.HTTPretty.latest_requests + assert (history[-1].path == + u'/resources/json/delphix/action/ACTION-161/getJob') + assert history[-2].path == u'/resources/json/delphix/login' + assert history[-3].path == u'/resources/json/delphix/session' + + @staticmethod + def test_delphix_client_wait_for_job_to_complete_timed_out( + engine_api, artifact_content): + session_body, session_header = TestDelphixClient.SES_RESP_SUCCESS + httpretty.register_uri( + httpretty.POST, + 'http://test-engine.com/resources/json/delphix/session', + body=session_body, + forcing_headers=session_header) + + login_body, login_header = TestDelphixClient.LOGIN_RESP_SUCCESS + httpretty.register_uri( + httpretty.POST, + 'http://test-engine.com/resources/json/delphix/login', + body=login_body, + forcing_headers=login_header) + + token_body, token_header = TestDelphixClient.TOKEN_RESP_SUCCESS + httpretty.register_uri(httpretty.POST, + 'http://test-engine.com/resources/' + 'json/delphix/toolkit/requestUploadToken', + body=token_body, + forcing_headers=token_header) + + job_body, job_header = TestDelphixClient.JOB_RESP_TIMED_OUT + httpretty.register_uri(httpretty.GET, + 'http://test-engine.com/resources/json/' + 'delphix/action/ACTION-161/getJob', + body=job_body) + + dc = delphix_client.DelphixClient('test-engine.com', 0) + dc.login(engine_api, 'admin', 'delphix') + + with pytest.raises(exceptions.PluginUploadWaitTimedOut) as err_info: + dc._wait_for_upload_to_complete('nix_direct_python', 'ACTION-161', + 'JOB-38') + + assert err_info.value.message == ('Timed out waiting for upload of ' + 'plugin nix_direct_python to ' + 'complete.') + + history = httpretty.HTTPretty.latest_requests + assert (history[-1].path == + u'/resources/json/delphix/action/ACTION-161/getJob') + assert history[-2].path == u'/resources/json/delphix/login' + assert history[-3].path == u'/resources/json/delphix/session' + @staticmethod def test_delphix_client_download_success(engine_api, src_dir, plugin_config_file): diff --git a/tools/src/test/python/dlpx/virtualization/_internal/commands/test_upload.py b/tools/src/test/python/dlpx/virtualization/_internal/commands/test_upload.py index 7e2804c5..444e5d2c 100644 --- a/tools/src/test/python/dlpx/virtualization/_internal/commands/test_upload.py +++ b/tools/src/test/python/dlpx/virtualization/_internal/commands/test_upload.py @@ -61,7 +61,7 @@ def login(self, engine_api, user, password): 'id': 'exception.webservices.login.failed' }) - def upload_plugin(self, name, content): + def upload_plugin(self, name, content, wait): if content.get('discoveryDefinition') is None: raise exceptions.HttpError( 200, { @@ -113,7 +113,7 @@ def test_upload_success(artifact_file, artifact_content, fake_client): user = 'admin' password = 'delphix' - upload.upload(fake_client.engine, user, artifact_file, password) + upload.upload(fake_client.engine, user, artifact_file, password, False) # Make sure that the fake client was passed in the correct contents. assert ( @@ -128,7 +128,8 @@ def test_upload_no_file(fake_client, artifact_file): password = 'delphix' with pytest.raises(exceptions.UserError) as err_info: - upload.upload(fake_client.engine, user, artifact_file, password) + upload.upload(fake_client.engine, user, artifact_file, password, + False) message = err_info.value.message assert message == ("Unable to read upload artifact file" @@ -148,7 +149,8 @@ def test_upload_file_not_json(artifact_file, fake_client): password = 'delphix' with pytest.raises(exceptions.UserError) as err_info: - upload.upload(fake_client.engine, user, artifact_file, password) + upload.upload(fake_client.engine, user, artifact_file, password, + False) message = err_info.value.message assert message == ( @@ -172,7 +174,8 @@ def test_upload_api_incorrect(artifact_file, fake_client): password = 'delphix' with pytest.raises(exceptions.HttpError) as err_info: - upload.upload(fake_client.engine, user, artifact_file, password) + upload.upload(fake_client.engine, user, artifact_file, password, + False) error = err_info.value.error message = err_info.value.message @@ -203,7 +206,8 @@ def test_upload_password_incorrect(artifact_file, artifact_content, password = 'delphix2' with pytest.raises(exceptions.HttpError) as err_info: - upload.upload(fake_client.engine, user, artifact_file, password) + upload.upload(fake_client.engine, user, artifact_file, password, + False) error = err_info.value.error message = err_info.value.message @@ -228,7 +232,8 @@ def test_upload_plugin_failed(artifact_file, artifact_content, password = 'delphix' with pytest.raises(exceptions.HttpError) as err_info: - upload.upload(fake_client.engine, user, artifact_file, password) + upload.upload(fake_client.engine, user, artifact_file, password, + False) error = err_info.value.error message = err_info.value.message diff --git a/tools/src/test/python/dlpx/virtualization/_internal/test_cli.py b/tools/src/test/python/dlpx/virtualization/_internal/test_cli.py index 2af62f6f..f9a98dc7 100644 --- a/tools/src/test/python/dlpx/virtualization/_internal/test_cli.py +++ b/tools/src/test/python/dlpx/virtualization/_internal/test_cli.py @@ -406,7 +406,7 @@ def test_default_params(mock_upload, artifact_file): assert result.exit_code == 0, 'Output: {}'.format(result.output) mock_upload.assert_called_once_with(engine, user, artifact_file, - password) + password, False) @staticmethod @mock.patch('dlpx.virtualization._internal.commands.upload.upload') @@ -423,7 +423,7 @@ def test_valid_params(mock_upload, artifact_file): assert result.exit_code == 0, 'Output: {}'.format(result.output) mock_upload.assert_called_once_with(engine, user, artifact_file, - password) + password, False) @staticmethod @mock.patch('dlpx.virtualization._internal.commands.upload.upload') @@ -452,7 +452,7 @@ def test_bad_password(mock_upload, artifact_file): '\nAction: Try with a different set of credentials.' '\n') mock_upload.assert_called_once_with(engine, user, artifact_file, - password) + password, False) @staticmethod @pytest.mark.parametrize('artifact_file', @@ -497,7 +497,7 @@ def test_with_config_file_success(mock_upload, artifact_file, assert result.exit_code == 0, 'Output: {}'.format(result.output) mock_upload.assert_called_once_with(engine, user, artifact_file, - password) + password, False) @staticmethod @mock.patch('dlpx.virtualization._internal.commands.upload.upload') @@ -517,7 +517,7 @@ def test_with_config_file_override(mock_upload, artifact_file, assert result.exit_code == 0, 'Output: {}'.format(result.output) mock_upload.assert_called_once_with(engine, user, artifact_file, - password) + password, False) @staticmethod @pytest.mark.parametrize('dvp_config_properties', [{ diff --git a/tools/src/test/python/dlpx/virtualization/_internal/test_package_util.py b/tools/src/test/python/dlpx/virtualization/_internal/test_package_util.py index 59ffa487..7a563d02 100644 --- a/tools/src/test/python/dlpx/virtualization/_internal/test_package_util.py +++ b/tools/src/test/python/dlpx/virtualization/_internal/test_package_util.py @@ -10,7 +10,7 @@ class TestPackageUtil: @staticmethod def test_get_version(): - assert package_util.get_version() == '2.0.0-internal-001' + assert package_util.get_version() == '2.0.0-internal-2' @staticmethod def test_get_virtualization_api_version(): diff --git a/tools/src/test/python/dlpx/virtualization/_internal/test_plugin_importer.py b/tools/src/test/python/dlpx/virtualization/_internal/test_plugin_importer.py index 05980b3f..ab31c65f 100644 --- a/tools/src/test/python/dlpx/virtualization/_internal/test_plugin_importer.py +++ b/tools/src/test/python/dlpx/virtualization/_internal/test_plugin_importer.py @@ -15,7 +15,6 @@ import yaml - @pytest.fixture def fake_src_dir(plugin_type): """