Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 3.0.0.dev2
current_version = 3.0.0.dev3
commit = False
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<dev>\d+))?
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0.dev2
3.0.0.dev3
2 changes: 1 addition & 1 deletion dvp/src/main/python/dlpx/virtualization/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0.dev2
3.0.0.dev3
2 changes: 1 addition & 1 deletion libs/src/main/python/dlpx/virtualization/libs/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0.dev2
3.0.0.dev3
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0.dev2
3.0.0.dev3
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.0.dev2
3.0.0.dev3
Original file line number Diff line number Diff line change
Expand Up @@ -188,18 +188,12 @@ def init(root, ingestion_strategy, name, host_type):
mutually_exclusive=['upload_artifact'],
help=('Only generate the Python classes from the schema definitions. '
'Do not do a full build or create an upload artifact.'))
@click.option('--skip-id-validation',
is_flag=True,
hidden=True,
help=('An internal flag that does not enforce the format '
'of the id. Use of this flag is unsupported.'))
@click.option('--dev',
is_flag=True,
hidden=True,
help=('An internal flag that installs dev builds of the '
'wrappers. This should only be used by SDK developers.'))
def build(plugin_config, upload_artifact, generate_only, skip_id_validation,
dev):
def build(plugin_config, upload_artifact, generate_only, dev):
"""
Build the plugin code and generate upload artifact file using the
configuration provided in the plugin config file.
Expand All @@ -225,7 +219,6 @@ def build(plugin_config, upload_artifact, generate_only, skip_id_validation,
build_internal.build(plugin_config,
upload_artifact,
generate_only,
skip_id_validation,
local_vsdk_root=local_vsdk_root)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
def build(plugin_config,
upload_artifact,
generate_only,
skip_id_validation,
local_vsdk_root=None):
"""This builds the plugin using the configurations provided in config yaml
file provided as input. It reads schemas and source code from the files
Expand All @@ -42,7 +41,6 @@ def build(plugin_config,
plugin_config: Plugin config file used for building plugin.
upload_artifact: The file to which output of build is written to.
generate_only: Only generate python classes from schema definitions.
skip_id_validation: Skip validation of the plugin id.
local_vsdk_root: The local path to the root of the Virtualization SDK
repository.
"""
Expand All @@ -57,7 +55,7 @@ def build(plugin_config,
logger.info('Validating plugin config file %s', plugin_config)
try:
result = plugin_util.validate_plugin_config_file(
plugin_config, not generate_only, skip_id_validation)
plugin_config, not generate_only)
except exceptions.UserError as err:
raise exceptions.BuildFailedError(err)

Expand Down Expand Up @@ -111,8 +109,7 @@ def build(plugin_config,
try:
result = plugin_util.get_plugin_manifest(plugin_config,
plugin_config_content,
not generate_only,
skip_id_validation)
not generate_only)
except (exceptions.UserError, exceptions.SDKToolingError) as err:
raise exceptions.BuildFailedError(err)

Expand Down Expand Up @@ -164,16 +161,9 @@ def prepare_upload_artifact(plugin_config_content, src_dir, schemas, manifest):
# Hard code the type to a set default.
'type':
TYPE,
#
# Delphix Engine still accepts only name and prettyName and
# hence name is mapped to id and prettyName to name.
# Delphix Engine does not accept upper case letters for name field,
# so we convert the name to lowercase letters.
# This will be changed as part of POST GA task PYT-628
#
'pluginId':
plugin_config_content['id'],
'name':
plugin_config_content['id'].lower(),
'prettyName':
plugin_config_content['name'],
# set default value of locale to en-us
'defaultLocale':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def __get_plugin_ref_from_id(self, plugin_name, plugin_id):
# and make sure the plugin hasn't been replicated.
# The 'name' field will be converted to 'id' in the future.
#
if p['name'] == plugin_id and p['namespace'] is None:
if p['identifier'] == plugin_id and p['namespace'] is None:
return p['reference']

raise exceptions.MissingPluginError(plugin_name, self.__engine)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ def validate_error_handler(plugin_file, validation_mode):


def validate_plugin_config_file(plugin_config,
stop_build,
skip_id_validation=False):
stop_build):
"""
Reads a plugin config file and validates the contents using a
pre-defined schema. If stop_build is True, will report exception
Expand All @@ -55,10 +54,8 @@ def validate_plugin_config_file(plugin_config,
"""
validation_mode = (ValidationMode.ERROR
if stop_build else ValidationMode.WARNING)
plugin_config_schema_file = (const.PLUGIN_CONFIG_SCHEMA_NO_ID_VALIDATION
if skip_id_validation else
const.PLUGIN_CONFIG_SCHEMA)
validator = PluginValidator(plugin_config, plugin_config_schema_file)

validator = PluginValidator(plugin_config, const.PLUGIN_CONFIG_SCHEMA)

with validate_error_handler(plugin_config, validation_mode):
validator.validate_plugin_config()
Expand All @@ -68,8 +65,7 @@ def validate_plugin_config_file(plugin_config,

def get_plugin_manifest(plugin_config_file,
plugin_config_content,
stop_build,
skip_id_validation=False):
stop_build):
"""
Validates the given plugin config content using a pre-defined schema.
Plugin config file name is used to get the absolute path of plugin source
Expand Down Expand Up @@ -115,7 +111,7 @@ def get_plugin_config_property(plugin_config_path, prop):
"""
Returns the value for a specific property from the plugin config file.
"""
result = validate_plugin_config_file(plugin_config_path, False, False)
result = validate_plugin_config_file(plugin_config_path, False)
return result.plugin_config_content[prop]


Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -377,15 +377,12 @@ def test_zip_and_encode_source_files_encode_fail(mock_encode, src_dir):
@mock.patch(
'dlpx.virtualization._internal.plugin_dependency_util.install_deps')
@mock.patch('os.path.isabs', return_value=False)
@pytest.mark.parametrize(('plugin_id', 'skip_id_validation'),
[('77f18ce4-4425-4cd6-b9a7-23653254d660', False),
('77f18ce4-4425-4cd6-b9a7-23653254d660', True),
('mongo', True)])
@pytest.mark.parametrize('plugin_id',
['77f18ce4-4425-4cd6-b9a7-23653254d660'])
def test_id_validation_positive(mock_relative_path, mock_install_deps,
mock_import_plugin, plugin_config_file,
artifact_file, skip_id_validation):
build.build(plugin_config_file, artifact_file, False,
skip_id_validation)
artifact_file):
build.build(plugin_config_file, artifact_file, False)

@staticmethod
@mock.patch.object(PluginImporter,
Expand Down Expand Up @@ -666,19 +663,6 @@ def test_manual_discovery_parameter(plugin_config_content, src_dir,
assert expected == upload_artifact['discoveryDefinition'][
'manualSourceConfigDiscovery']

@staticmethod
def test_plugin_config_schemas_diff():
with open(const.PLUGIN_CONFIG_SCHEMA) as f:
config_schema = json.load(f)

with open(const.PLUGIN_CONFIG_SCHEMA_NO_ID_VALIDATION) as f:
config_schema_no_id = json.load(f)

# Only the id's pattern should be different so remove it.
config_schema['properties']['id'].pop('pattern')

assert config_schema == config_schema_no_id

@staticmethod
@pytest.mark.parametrize('build_number, expected', [
pytest.param('0.0.1', '0.0.1'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ def httpretty_enabled():
'{"type": "Toolkit", "reference": "APPDATA_TOOLKIT-1",'
'"namespace": null, "prettyName": "python_vfiles",'
'"name": "16bef554-9470-11e9-b2e3-8c8590d4a42c", "language": "LUA",'
'"identifier": "16bef554-9470-11e9-b2e3-8c8590d4a42c",'
'"version": "1.0.0", "buildApi": {"type": "APIVersion",'
'"major": 1, "minor": 10, "micro": 5}, "hostTypes": ['
'"UNIX", "WINDOWS"], "rootSquashEnabled": true, '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,8 @@ def artifact_content(engine_api, virtual_source_definition,
"""
artifact = {
'type': 'Plugin',
'name': '16bef554-9470-11e9-b2e3-8c8590d4a42c',
'prettyName': 'python_vfiles',
'pluginId': '16bef554-9470-11e9-b2e3-8c8590d4a42c',
'name': 'python_vfiles',
'externalVersion': '2.0.0',
'defaultLocale': 'en-us',
'language': 'PYTHON27',
Expand Down
22 changes: 0 additions & 22 deletions tools/src/test/python/dlpx/virtualization/_internal/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ def test_default_plugin_file_success(mock_build, plugin_config_filename,
mock_build.assert_called_once_with(plugin_config_file,
artifact_file,
False,
False,
local_vsdk_root=None)

@staticmethod
Expand All @@ -290,7 +289,6 @@ def test_generate_only_success(mock_build, plugin_config_filename,
mock_build.assert_called_once_with(plugin_config_file,
None,
True,
False,
local_vsdk_root=None)

@staticmethod
Expand All @@ -305,7 +303,6 @@ def test_valid_params(mock_build, plugin_config_file, artifact_file):
mock_build.assert_called_once_with(plugin_config_file,
artifact_file,
False,
False,
local_vsdk_root=None)

@staticmethod
Expand All @@ -322,24 +319,6 @@ def test_valid_params_new_name(mock_build, plugin_config_file,
os.path.join(
os.getcwd(), artifact_filename),
False,
False,
local_vsdk_root=None)

@staticmethod
@mock.patch('dlpx.virtualization._internal.commands.build.build')
def test_skip_id_validation(mock_build, plugin_config_file, artifact_file):
runner = click_testing.CliRunner()

result = runner.invoke(cli.delphix_sdk, [
'build', '-c', plugin_config_file, '-a', artifact_file,
'--skip-id-validation'
])

assert result.exit_code == 0, 'Output: {}'.format(result.output)
mock_build.assert_called_once_with(plugin_config_file,
artifact_file,
False,
True,
local_vsdk_root=None)

@staticmethod
Expand Down Expand Up @@ -403,7 +382,6 @@ def test_with_dev(mock_build, plugin_config_file, artifact_file,
mock_build.assert_called_once_with(plugin_config_file,
artifact_file,
False,
False,
local_vsdk_root='/path/to/vsdk/dir')

@staticmethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class TestPackageUtil:
@staticmethod
def test_get_version():
assert package_util.get_version() == '3.0.0.dev2'
assert package_util.get_version() == '3.0.0.dev3'

@staticmethod
def test_get_virtualization_api_version():
Expand Down