From bddabb2b79e1d3328ca2fa8f11a3030dfe387372 Mon Sep 17 00:00:00 2001 From: Hung Nguyen Date: Fri, 15 Sep 2023 15:37:47 -0400 Subject: [PATCH] handle hashed_passwords not being set (#123) * handle hashed_passwords not being set * migrator script update: instantiate key if doesnt exist * adding maxCompressedImageSizeMB test * fix envVar being anything other than a string * updating tests to make extraEnv a string. update mapping for postgresql.imageTag * updating script for case of postgres user being postgres admin user Signed-off-by: Hung Nguyen --------- Signed-off-by: Hung Nguyen --- scripts/helpers.py | 26 ++++++ scripts/mappings.py | 2 +- .../configs/test_convert_values_file.yaml | 5 +- .../test_convert_values_file_result.yaml | 8 +- .../test_anchoreAnalyzer_value_mapping.py | 29 ++++--- .../tests/test_anchoreApi_value_mapping.py | 23 ++--- .../test_anchoreCatalog_value_mapping.py | 28 ++++--- ...t_anchoreEngineUpgradeJob_value_mapping.py | 14 ++-- ...nterpriseEngineUpgradeJob_value_mapping.py | 18 ++-- ...EnterpriseFeedsUpgradeJob_value_mapping.py | 18 ++-- ...st_anchoreEnterpriseFeeds_value_mapping.py | 70 ++++++++-------- ...reEnterpriseNotifications_value_mapping.py | 26 +++--- ...est_anchoreEnterpriseRbac_value_mapping.py | 28 +++---- ..._anchoreEnterpriseReports_value_mapping.py | 31 ++++--- .../test_anchoreEnterpriseUi_value_mapping.py | 50 ++++++----- .../tests/test_anchoreGlobal_value_mapping.py | 83 +++++++++++++------ .../test_anchorePolicyEngine_value_mapping.py | 24 +++--- .../test_anchoreSimpleQueue_value_mapping.py | 22 ++--- scripts/tests/test_helpers.py | 6 ++ 19 files changed, 311 insertions(+), 200 deletions(-) diff --git a/scripts/helpers.py b/scripts/helpers.py index 6ec992dc..31de35cb 100644 --- a/scripts/helpers.py +++ b/scripts/helpers.py @@ -19,6 +19,13 @@ def represent_block_scalar(dumper, data): style = "|" if "\n" in data else '"' return dumper.represent_scalar("tag:yaml.org,2002:str", data, style=style) +def convert_to_str(env_var): + if isinstance(env_var, dict): + if not isinstance(env_var.get('value'), str): + env_var['value'] = str(env_var.get('value')) + else: + return str(env_var) + def convert_values_file(file, results_dir): file_name = os.path.basename(file) prep_dir(path=results_dir, clean=True) @@ -32,6 +39,17 @@ def convert_values_file(file, results_dir): enterprise_chart_values_dict, enterprise_chart_env_var_dict = replace_keys_with_mappings(dot_string_dict, results_dir) for key, val in enterprise_chart_env_var_dict.items(): + if isinstance(val, list): + for index, env_var in enumerate(val): + val[index] = convert_to_str(env_var) or env_var + elif isinstance(val, dict): + for index, env_var in enumerate(val.get("extraEnv", [])): + val["extraEnv"][index] = convert_to_str(env_var) or env_var + + # taking the environment variables and adding it into the enterprise_chart_values_dict to make one dictionary + if key not in enterprise_chart_values_dict: + val_type = type(val) + enterprise_chart_values_dict[key] = val_type() if isinstance(val, list): enterprise_chart_values_dict[key] = enterprise_chart_values_dict[key] + val elif isinstance(val, dict): @@ -39,6 +57,10 @@ def convert_values_file(file, results_dir): enterprise_chart_values_dict[key]["extraEnv"] = enterprise_chart_values_dict[key].get("extraEnv", []) enterprise_chart_values_dict[key]["extraEnv"] = enterprise_chart_values_dict[key]["extraEnv"] + val.get("extraEnv", []) + # for the current bitnami postgres chart, if your user is specifically the 'postgres' admin user, you need to override global.postgresql.auth.postgresPassword + if (enterprise_chart_values_dict.get('postgresql', {}).get('auth', {}).get('username') == 'postgres') and (enterprise_chart_values_dict.get('postgresql', {}).get('auth', {}).get('password')): + enterprise_chart_values_dict['postgresql']['auth']['postgresPassword'] = enterprise_chart_values_dict['postgresql']['auth']['password'] + yaml.add_representer(str, represent_block_scalar) yaml_data = yaml.dump(enterprise_chart_values_dict, default_flow_style=False) file_name = f"enterprise.{file_name}" @@ -93,6 +115,10 @@ def replace_keys_with_mappings(dot_string_dict, results_dir): env_var_mapping = {**enterprise_env_var_mapping, **feeds_env_var_mapping} logs_dir = f"{results_dir}/logs" + if not dot_string_dict.get("anchoreGlobal.hashedPasswords"): + log_file_name = "warning.log" + write_to_file(f"hashedPasswords is not currently used. You should _really_ consider using it. Please see docs on how to migrate to hashed passwords.\n", os.path.join(logs_dir, log_file_name), "a") + dot_string_dict["anchoreGlobal.hashedPasswords"] = False for dotstring_key, val in dot_string_dict.items(): keys = dotstring_key.split('.') diff --git a/scripts/mappings.py b/scripts/mappings.py index 90d329d1..e0cec839 100644 --- a/scripts/mappings.py +++ b/scripts/mappings.py @@ -128,7 +128,7 @@ "postgresql.postgresPassword": "postgresql.auth.password", "postgresql.postgresUser": "postgresql.auth.username", "postgresql.postgresPort": "postgresql.primary.service.ports.postgresql", - "postgresql.imageTag": "postgresql.imageTag", + "postgresql.imageTag": "postgresql.image.tag", "anchore-feeds-db.imageTag": "feeds.feeds-db.image.tag", "anchore-feeds-gem-db.imageTag": "feeds.gem-db.image.tag", diff --git a/scripts/tests/configs/test_convert_values_file.yaml b/scripts/tests/configs/test_convert_values_file.yaml index 8d2d86e3..38f527ed 100644 --- a/scripts/tests/configs/test_convert_values_file.yaml +++ b/scripts/tests/configs/test_convert_values_file.yaml @@ -4,6 +4,9 @@ anchoreEnterpriseGlobal: anchoreGlobal: useExistingSecrets: true existingSecretName: global-existing-secrets + extraEnv: + - name: ANCHORE_MAX_REQUEST_THREADS + value: "9876543210" anchoreEnterpriseUi: existingSecretName: ui-existing-secrets @@ -12,4 +15,4 @@ anchoreEnterpriseFeeds: existingSecretName: feeds-existing-secrets anchoreApi: - maxRequestThreads: 9876543210 \ No newline at end of file + maxRequestThreads: 9876543210 diff --git a/scripts/tests/configs/test_convert_values_file_result.yaml b/scripts/tests/configs/test_convert_values_file_result.yaml index 18fa8a86..3729a2bd 100644 --- a/scripts/tests/configs/test_convert_values_file_result.yaml +++ b/scripts/tests/configs/test_convert_values_file_result.yaml @@ -8,4 +8,10 @@ "api": "extraEnv": - "name": "ANCHORE_MAX_REQUEST_THREADS" - "value": 9876543210 \ No newline at end of file + "value": "9876543210" +"anchoreConfig": + "user_authentication": + "hashed_passwords": False +"extraEnv": + - "name": "ANCHORE_MAX_REQUEST_THREADS" + "value": "9876543210" \ No newline at end of file diff --git a/scripts/tests/test_anchoreAnalyzer_value_mapping.py b/scripts/tests/test_anchoreAnalyzer_value_mapping.py index 5e112c70..fef76645 100644 --- a/scripts/tests/test_anchoreAnalyzer_value_mapping.py +++ b/scripts/tests/test_anchoreAnalyzer_value_mapping.py @@ -17,7 +17,7 @@ def test_anchoreAnalyzer_replicaCount_value(self): dot_string_dict = { "anchoreAnalyzer.replicaCount": 2, } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'analyzer': { 'replicaCount': 2 } @@ -29,7 +29,7 @@ def test_anchoreAnalyzer_containerPort_value(self): dot_string_dict = { "anchoreAnalyzer.containerPort": 8084, } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'analyzer': { 'service': { 'port': 8084 @@ -48,7 +48,7 @@ def test_anchoreAnalyzer_extraEnv_value(self): } ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'analyzer': { 'extraEnv': [ { @@ -65,7 +65,7 @@ def test_anchoreAnalyzer_serviceAccountName_value(self): dot_string_dict = { "anchoreAnalyzer.serviceAccountName": "foo", } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'analyzer': { 'serviceAccountName': 'foo' } @@ -80,7 +80,7 @@ def test_anchoreAnalyzer_resources_value(self): "anchoreAnalyzer.resources.requests.cpu": 1, "anchoreAnalyzer.resources.requests.memory": "1G", } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'analyzer': { 'resources': { 'limits': { @@ -103,7 +103,7 @@ def test_anchoreAnalyzer_labels_value(self): "anchoreAnalyzer.labels.value": "bar", "anchoreAnalyzer.labels.kubernetes.io/description": "baz", } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'analyzer': { 'labels': { @@ -122,7 +122,7 @@ def test_anchoreAnalyzer_annotations_value(self): "anchoreAnalyzer.annotations.value": "bar", "anchoreAnalyzer.annotations.kubernetes.io/description": "baz", } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'analyzer': { 'annotations': { @@ -140,7 +140,7 @@ def test_anchoreanalyzer_deploymentAnnotations_value(self): "anchoreAnalyzer.deploymentAnnotations.name": "foo", "anchoreAnalyzer.deploymentAnnotations.value": "bar", } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'analyzer': { 'deploymentAnnotations': { 'name': 'foo', @@ -157,7 +157,7 @@ def test_anchoreAnalyzer_nodeSelector_value(self): "anchoreAnalyzer.nodeSelector.value": "bar", } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'analyzer': { 'nodeSelector': { @@ -179,7 +179,7 @@ def test_anchoreAnalyzer_tolerations_value(self): } ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'analyzer': { 'tolerations': [ { @@ -197,7 +197,7 @@ def test_anchoreAnalyzer_affinity_value(self): "anchoreAnalyzer.affinity.name": "foo", "anchoreAnalyzer.affinity.value": "bar", } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'analyzer': { 'affinity': { 'name': 'foo', @@ -214,6 +214,7 @@ def test_anchoreAnalyzer_cycleTimers_image_analyzer_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'analyzer': { 'cycle_timers': { 'image_analyzer': 1 @@ -231,6 +232,7 @@ def test_anchoreAnalyzer_concurrentTasksPerWorker_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'analyzer': { 'max_threads': 1 } @@ -246,6 +248,7 @@ def test_anchoreAnalyzer_layerCacheMaxGigabytes_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'analyzer': { 'layer_cache_max_gigabytes': 1 } @@ -261,6 +264,7 @@ def test_anchoreAnalyzer_enableHints_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'analyzer': { 'enable_hints': False } @@ -294,6 +298,7 @@ def test_anchoreAnalyzer_configFile_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'analyzer': { 'configFile': { 'retrieve_files': { @@ -341,5 +346,5 @@ def test_enableOwnedPackageFiltering_value(self): } } result = replace_keys_with_mappings(dot_string_dict, self.results_dir) - self.assertEqual(result[0], {}) + self.assertEqual(result[0], {'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}}) self.assertEqual(result[1], expected_result) \ No newline at end of file diff --git a/scripts/tests/test_anchoreApi_value_mapping.py b/scripts/tests/test_anchoreApi_value_mapping.py index b750419e..3d7f687f 100644 --- a/scripts/tests/test_anchoreApi_value_mapping.py +++ b/scripts/tests/test_anchoreApi_value_mapping.py @@ -17,7 +17,7 @@ def test_anchoreApi_replicaCount_value(self): dot_string_dict = { "anchoreApi.replicaCount": 2, } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'api': { 'replicaCount': 2 } @@ -34,7 +34,7 @@ def test_anchoreApi_extraEnv_value(self): } ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'api': { 'extraEnv': [ { @@ -59,7 +59,7 @@ def test_anchoreApi_service_value(self): "anchoreApi.service.labels.with.a.dot.foobar": "baz" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'api': { 'service': { "name": "null", @@ -84,7 +84,7 @@ def test_anchoreApi_serviceAccountName_value(self): dot_string_dict = { "anchoreApi.serviceAccountName": "Null" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'api': { 'serviceAccountName': "Null" } @@ -100,7 +100,7 @@ def test_anchoreApi_resources_value(self): "anchoreApi.resources.requests.memory": "1G", } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'api': { 'resources': { 'limits': { @@ -123,7 +123,7 @@ def test_anchoreApi_labels_value(self): "anchoreApi.labels.value": "bar", "anchoreApi.labels.anotherLabel.with.a.dot": "baz", } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'api': { 'labels': { @@ -141,7 +141,7 @@ def test_anchoreApi_annotations_value(self): "anchoreApi.annotations.foo": "bar", "anchoreApi.annotations.baz": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'api': { 'annotations': { @@ -158,7 +158,7 @@ def test_anchoreApi_deploymentAnnotations_value(self): "anchoreApi.deploymentAnnotations.name": "foo", "anchoreApi.deploymentAnnotations.mydot.value": "bar" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'api': { 'deploymentAnnotations': { 'name': 'foo', @@ -174,7 +174,7 @@ def test_anchoreApi_nodeSelector_value(self): "anchoreApi.nodeSelector.name": "foo", "anchoreApi.nodeSelector.value": "bar" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'api': { 'nodeSelector': { @@ -195,7 +195,7 @@ def test_anchoreApi_tolerations_value(self): } ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'api': { 'tolerations': [ { @@ -213,7 +213,7 @@ def test_anchoreApi_affinity_value(self): "anchoreApi.affinity.name": "foo", "anchoreApi.affinity.value": "bar" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'api': { 'affinity': { 'name': 'foo', @@ -232,6 +232,7 @@ def test_anchoreApi_external_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'apiext': { 'external': { 'useTLS': True, diff --git a/scripts/tests/test_anchoreCatalog_value_mapping.py b/scripts/tests/test_anchoreCatalog_value_mapping.py index 1cc9432b..3bc1b482 100644 --- a/scripts/tests/test_anchoreCatalog_value_mapping.py +++ b/scripts/tests/test_anchoreCatalog_value_mapping.py @@ -17,7 +17,7 @@ def test_anchoreCatalog_replicaCount_value(self): dot_string_dict = { "anchoreCatalog.replicaCount": 2, } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'catalog': { 'replicaCount': 2 } @@ -34,7 +34,7 @@ def test_anchoreCatalog_extraEnv_value(self): } ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'catalog': { 'extraEnv': [ { @@ -51,7 +51,7 @@ def test_anchoreCatalog_serviceAccountName_value(self): dot_string_dict = { "anchoreCatalog.serviceAccountName": "Null" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'catalog': { 'serviceAccountName': "Null" } @@ -70,7 +70,7 @@ def test_anchoreCatalog_service_value(self): "anchoreCatalog.service.labels.foobar": "baz", "anchoreCatalog.service.labels.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'catalog': { 'service': { "name": "Null", @@ -98,7 +98,7 @@ def test_anchoreCatalog_resources_value(self): "anchoreCatalog.resources.requests.cpu": 1, "anchoreCatalog.resources.requests.memory": "1G" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'catalog': { 'resources': { 'limits': { @@ -121,7 +121,7 @@ def test_anchoreCatalog_labels_value(self): "anchoreCatalog.labels.myOtherLabel": "myOtherValue", "anchoreCatalog.labels.anotherLabel.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'catalog': { 'labels': { @@ -140,7 +140,7 @@ def test_anchoreCatalog_annotations_value(self): "anchoreCatalog.annotations.bar": "baz", "anchoreCatalog.annotations.anotherLabel.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'catalog': { 'annotations': { @@ -160,7 +160,7 @@ def test_anchoreCatalog_deploymentAnnotations_value(self): "anchoreCatalog.deploymentAnnotations.bar": "baz", "anchoreCatalog.deploymentAnnotations.anotherLabel.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'catalog': { 'deploymentAnnotations': { @@ -179,7 +179,7 @@ def test_anchoreCatalog_nodeSelector_value(self): "anchoreCatalog.nodeSelector.value": "bar", "anchoreCatalog.nodeSelector.anotherLabel.with.a.dot": "baz" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'catalog': { 'nodeSelector': { @@ -201,7 +201,7 @@ def test_anchoreCatalog_tolerations_value(self): } ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'catalog': { 'tolerations': [ { @@ -220,7 +220,7 @@ def test_anchoreCatalog_affinity_value(self): "anchoreCatalog.affinity.value": "bar", "anchoreCatalog.affinity.anotherLabel.with.a.dot": "baz" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'catalog': { 'affinity':{ 'name': 'foo', @@ -250,6 +250,7 @@ def test_anchoreCatalog_cycleTimers_value(self): expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'catalog': { 'cycle_timers': { 'analyzer_queue': 1, @@ -282,6 +283,7 @@ def test_anchoreCatalog_events_value(self): expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'catalog': { 'event_log': { 'max_retention_age_days': 0, @@ -315,6 +317,7 @@ def test_anchoreCatalog_analysis_archive_value(self): expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'catalog': { 'analysis_archive': { 'compression': { @@ -351,6 +354,7 @@ def test_anchoreCatalog_object_store_value(self): expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'catalog': { 'object_store': { 'compression': { @@ -375,6 +379,7 @@ def test_anchoreCatalog_runtimeInventory_value(self): expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'catalog': { 'runtime_inventory': { 'image_ttl_days': 1 @@ -392,6 +397,7 @@ def test_anchoreCatalog_downAnalyzerTaskRequeue_value(self): expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'catalog': { 'down_analyzer_task_requeue': True } diff --git a/scripts/tests/test_anchoreEngineUpgradeJob_value_mapping.py b/scripts/tests/test_anchoreEngineUpgradeJob_value_mapping.py index 5c69d023..2231e233 100644 --- a/scripts/tests/test_anchoreEngineUpgradeJob_value_mapping.py +++ b/scripts/tests/test_anchoreEngineUpgradeJob_value_mapping.py @@ -17,7 +17,7 @@ def test_anchoreEngineUpgradeJob_enabled_value(self): dot_string_dict = { "anchoreEngineUpgradeJob.enabled": True } - expected_result = {} + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}},} result = replace_keys_with_mappings(dot_string_dict, self.results_dir) self.assertEqual(result[0], expected_result) @@ -28,7 +28,7 @@ def test_anchoreEngineUpgradeJob_resources_value(self): "anchoreEngineUpgradeJob.resources.requests.cpu": 1, "anchoreEngineUpgradeJob.resources.requests.memory": "1G" } - expected_result = {} + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}},} result = replace_keys_with_mappings(dot_string_dict, self.results_dir) self.assertEqual(result[0], expected_result) @@ -38,7 +38,7 @@ def test_anchoreEngineUpgradeJob_labels_value(self): "anchoreEngineUpgradeJob.labels.myOtherLabel": "myOtherValue", "anchoreEngineUpgradeJob.labels.anotherLabel.with.a.dot": "qux" } - expected_result = {} + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}},} result = replace_keys_with_mappings(dot_string_dict, self.results_dir) self.assertEqual(result[0], expected_result) @@ -48,7 +48,7 @@ def test_anchoreEngineUpgradeJob_annotations_value(self): "anchoreEngineUpgradeJob.annotations.bar": "baz", "anchoreEngineUpgradeJob.annotations.anotherLabel.with.a.dot": "qux" } - expected_result = {} + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}},} result = replace_keys_with_mappings(dot_string_dict, self.results_dir) self.assertEqual(result[0], expected_result) @@ -58,7 +58,7 @@ def test_anchoreEngineUpgradeJob_nodeSelector_value(self): "anchoreEngineUpgradeJob.nodeSelector.value": "bar", "anchoreEngineUpgradeJob.nodeSelector.anotherLabel.with.a.dot": "baz" } - expected_result = {} + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}},} result = replace_keys_with_mappings(dot_string_dict, self.results_dir) self.assertEqual(result[0], expected_result) @@ -71,7 +71,7 @@ def test_anchoreEngineUpgradeJob_tolerations_value(self): } ] } - expected_result = {} + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}},} result = replace_keys_with_mappings(dot_string_dict, self.results_dir) self.assertEqual(result[0], expected_result) @@ -81,6 +81,6 @@ def test_anchoreEngineUpgradeJob_affinity_value(self): "anchoreEngineUpgradeJob.affinity.value": "bar", "anchoreEngineUpgradeJob.affinity.anotherLabel.with.a.dot": "baz" } - expected_result = {} + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}},} result = replace_keys_with_mappings(dot_string_dict, self.results_dir) self.assertEqual(result[0], expected_result) diff --git a/scripts/tests/test_anchoreEnterpriseEngineUpgradeJob_value_mapping.py b/scripts/tests/test_anchoreEnterpriseEngineUpgradeJob_value_mapping.py index 9e807d16..b7e9de79 100644 --- a/scripts/tests/test_anchoreEnterpriseEngineUpgradeJob_value_mapping.py +++ b/scripts/tests/test_anchoreEnterpriseEngineUpgradeJob_value_mapping.py @@ -17,7 +17,7 @@ def test_anchoreEnterpriseEngineUpgradeJob_enabled_value(self): dot_string_dict = { "anchoreEnterpriseEngineUpgradeJob.enabled": True } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'upgradeJob': { 'enabled': True } @@ -32,7 +32,7 @@ def test_anchoreEnterpriseEngineUpgradeJob_resources_value(self): "anchoreEnterpriseEngineUpgradeJob.resources.requests.cpu": 1, "anchoreEnterpriseEngineUpgradeJob.resources.requests.memory": "1G" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'upgradeJob': { 'resources': { 'limits': { @@ -56,7 +56,7 @@ def test_anchoreEnterpriseEngineUpgradeJob_labels_value(self): "anchoreEnterpriseEngineUpgradeJob.labels.myOtherLabel": "myOtherValue", "anchoreEnterpriseEngineUpgradeJob.labels.anotherLabel.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'upgradeJob': { 'labels': { @@ -75,7 +75,7 @@ def test_anchoreEnterpriseEngineUpgradeJob_annotations_value(self): "anchoreEnterpriseEngineUpgradeJob.annotations.bar": "baz", "anchoreEnterpriseEngineUpgradeJob.annotations.anotherLabel.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'upgradeJob': { 'annotations': { @@ -95,7 +95,7 @@ def test_anchoreEnterpriseEngineUpgradeJob_nodeSelector_value(self): "anchoreEnterpriseEngineUpgradeJob.nodeSelector.value": "bar", "anchoreEnterpriseEngineUpgradeJob.nodeSelector.anotherLabel.with.a.dot": "baz" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'upgradeJob': { 'nodeSelector': { @@ -117,7 +117,7 @@ def test_anchoreEnterpriseEngineUpgradeJob_tolerations_value(self): } ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'upgradeJob': { 'tolerations': [ { @@ -136,7 +136,7 @@ def test_anchoreEnterpriseEngineUpgradeJob_affinity_value(self): "anchoreEnterpriseEngineUpgradeJob.affinity.value": "bar", "anchoreEnterpriseEngineUpgradeJob.affinity.anotherLabel.with.a.dot": "baz" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'upgradeJob': { 'affinity':{ 'name': 'foo', @@ -157,7 +157,7 @@ def test_anchoreEnterpriseEngineUpgradeJob_extraEnv_value(self): } ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'upgradeJob': { 'extraEnv': [ { @@ -174,7 +174,7 @@ def test_anchoreEnterpriseEngineUpgradeJob_serviceAccountName_value(self): dot_string_dict = { "anchoreEnterpriseEngineUpgradeJob.serviceAccountName": "Null" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'upgradeJob': { 'serviceAccountName': "Null" } diff --git a/scripts/tests/test_anchoreEnterpriseFeedsUpgradeJob_value_mapping.py b/scripts/tests/test_anchoreEnterpriseFeedsUpgradeJob_value_mapping.py index 1d6f781e..88fb2630 100644 --- a/scripts/tests/test_anchoreEnterpriseFeedsUpgradeJob_value_mapping.py +++ b/scripts/tests/test_anchoreEnterpriseFeedsUpgradeJob_value_mapping.py @@ -17,7 +17,7 @@ def test_anchoreEnterpriseFeedsUpgradeJob_enabled_value(self): dot_string_dict = { "anchoreEnterpriseFeedsUpgradeJob.enabled": True, } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'feedsUpgradeJob': { 'enabled': True @@ -34,7 +34,7 @@ def test_anchoreEnterpriseFeedsUpgradeJob_resources_value(self): "anchoreEnterpriseFeedsUpgradeJob.resources.requests.cpu": 1, "anchoreEnterpriseFeedsUpgradeJob.resources.requests.memory": "1G" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'feedsUpgradeJob': { 'resources': { @@ -60,7 +60,7 @@ def test_anchoreEnterpriseFeedsUpgradeJob_labels_value(self): "anchoreEnterpriseFeedsUpgradeJob.labels.myOtherLabel": "myOtherValue", "anchoreEnterpriseFeedsUpgradeJob.labels.anotherLabel.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'feedsUpgradeJob': { 'labels': @@ -81,7 +81,7 @@ def test_anchoreEnterpriseFeedsUpgradeJob_annotations_value(self): "anchoreEnterpriseFeedsUpgradeJob.annotations.bar": "baz", "anchoreEnterpriseFeedsUpgradeJob.annotations.anotherLabel.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'feedsUpgradeJob': { 'annotations': @@ -102,7 +102,7 @@ def test_anchoreEnterpriseFeedsUpgradeJob_nodeSelector_value(self): "anchoreEnterpriseFeedsUpgradeJob.nodeSelector.value": "bar", "anchoreEnterpriseFeedsUpgradeJob.nodeSelector.anotherLabel.with.a.dot": "baz" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'feedsUpgradeJob': { 'nodeSelector': @@ -126,7 +126,7 @@ def test_anchoreEnterpriseFeedsUpgradeJob_tolerations_value(self): } ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'feedsUpgradeJob': { 'tolerations': [ @@ -147,7 +147,7 @@ def test_anchoreEnterpriseFeedsUpgradeJob_affinity_value(self): "anchoreEnterpriseFeedsUpgradeJob.affinity.value": "bar", "anchoreEnterpriseFeedsUpgradeJob.affinity.anotherLabel.with.a.dot": "baz" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'feedsUpgradeJob': { 'affinity':{ @@ -170,7 +170,7 @@ def test_anchoreEnterpriseFeedsUpgradeJob_extraEnv_value(self): } ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'feedsUpgradeJob': { 'extraEnv': [ @@ -189,7 +189,7 @@ def test_anchoreEnterpriseFeedsUpgradeJob_serviceAccountName_value(self): dot_string_dict = { "anchoreEnterpriseFeedsUpgradeJob.serviceAccountName": "Null" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'feedsUpgradeJob': { 'serviceAccountName': "Null" diff --git a/scripts/tests/test_anchoreEnterpriseFeeds_value_mapping.py b/scripts/tests/test_anchoreEnterpriseFeeds_value_mapping.py index eb93addc..8c5f205c 100644 --- a/scripts/tests/test_anchoreEnterpriseFeeds_value_mapping.py +++ b/scripts/tests/test_anchoreEnterpriseFeeds_value_mapping.py @@ -17,7 +17,7 @@ def test_anchoreEnterpriseFeeds_enabled_value(self): dot_string_dict = { "anchoreEnterpriseFeeds.enabled": True, } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'chartEnabled': True } @@ -29,7 +29,7 @@ def test_anchoreEnterpriseFeeds_replicaCount_value(self): dot_string_dict = { "anchoreEnterpriseFeeds.replicaCount": 2, } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'replicaCount': 2 } @@ -45,7 +45,7 @@ def test_anchoreEnterpriseFeeds_resources_value(self): "anchoreEnterpriseFeeds.resources.requests.cpu": 1, "anchoreEnterpriseFeeds.resources.requests.memory": "1G" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'resources': { 'limits': { @@ -69,7 +69,7 @@ def test_anchoreEnterpriseFeeds_labels_value(self): "anchoreEnterpriseFeeds.labels.myOtherLabel": "myOtherValue", "anchoreEnterpriseFeeds.labels.anotherLabel.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'labels': { @@ -88,7 +88,7 @@ def test_anchoreEnterpriseFeeds_annotations_value(self): "anchoreEnterpriseFeeds.annotations.bar": "baz", "anchoreEnterpriseFeeds.annotations.anotherLabel.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'annotations': { @@ -108,7 +108,7 @@ def test_anchoreEnterpriseFeeds_deploymentAnnotations_value(self): "anchoreEnterpriseFeeds.deploymentAnnotations.bar": "baz", "anchoreEnterpriseFeeds.deploymentAnnotations.anotherLabel.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'deploymentAnnotations': { @@ -127,7 +127,7 @@ def test_anchoreEnterpriseFeeds_nodeSelector_value(self): "anchoreEnterpriseFeeds.nodeSelector.value": "bar", "anchoreEnterpriseFeeds.nodeSelector.anotherLabel.with.a.dot": "baz" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'nodeSelector': { @@ -149,7 +149,7 @@ def test_anchoreEnterpriseFeeds_tolerations_value(self): } ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'tolerations': [ { @@ -168,7 +168,7 @@ def test_anchoreEnterpriseFeeds_affinity_value(self): "anchoreEnterpriseFeeds.affinity.value": "bar", "anchoreEnterpriseFeeds.affinity.anotherLabel.with.a.dot": "baz" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'affinity':{ 'name': 'foo', @@ -189,7 +189,7 @@ def test_anchoreEnterpriseFeeds_extraEnv_value(self): } ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'extraEnv': [ { @@ -206,7 +206,7 @@ def test_anchoreEnterpriseFeeds_serviceAccountName_value(self): dot_string_dict = { "anchoreEnterpriseFeeds.serviceAccountName": "Null" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'serviceAccountName': "Null" } @@ -226,7 +226,7 @@ def test_anchoreEnterpriseFeeds_service_value(self): "anchoreEnterpriseFeeds.service.labels.foobar": "baz", "anchoreEnterpriseFeeds.service.labels.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'service': { "name": "Null", @@ -251,7 +251,7 @@ def test_anchoreEnterpriseFeeds_url_value(self): dot_string_dict = { "anchoreEnterpriseFeeds.url": "https://myhostname:9999" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'url': "https://myhostname:9999" } @@ -273,7 +273,7 @@ def test_anchoreEnterpriseFeeds_driver_values(self): ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'anchoreConfig': { 'feeds': { @@ -297,7 +297,7 @@ def test_anchoreEnterpriseFeeds_ubuntuExtraReleases_values(self): "anchoreEnterpriseFeeds.ubuntuExtraReleases.kinetic": "22.10" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'anchoreConfig': { 'feeds': { @@ -321,7 +321,7 @@ def test_anchoreEnterpriseFeeds_ubuntuExtraReleases_empty_values(self): "anchoreEnterpriseFeeds.ubuntuExtraReleases": {} } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'anchoreConfig': { 'feeds': { @@ -343,7 +343,7 @@ def test_anchoreEnterpriseFeeds_debianExtraReleases_values(self): "anchoreEnterpriseFeeds.debianExtraReleases.trixie": "13" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'anchoreConfig': { 'feeds': { @@ -367,7 +367,7 @@ def test_anchoreEnterpriseFeeds_debianExtraReleases_empty_values(self): "anchoreEnterpriseFeeds.debianExtraReleases": {} } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'anchoreConfig': { 'feeds': { @@ -389,7 +389,7 @@ def test_anchoreEnterpriseFeeds_cycleTimers_values(self): "anchoreEnterpriseFeeds.cycleTimers.driver_sync": 7200 } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'anchoreConfig': { 'feeds': { @@ -416,7 +416,7 @@ def test_anchoreEnterpriseFeeds_dbConfig_with_engineArgs_values(self): "anchoreEnterpriseFeeds.dbConfig.engineArgs.pool_recycle": 600 } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'anchoreConfig': { 'dbConfig': { @@ -449,7 +449,7 @@ def test_anchoreEnterpriseFeeds_dbConfig_values(self): "anchoreEnterpriseFeeds.dbConfig.engineArgs": {} } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'anchoreConfig': { 'dbConfig': { @@ -475,7 +475,7 @@ def test_anchoreEnterpriseFeeds_persistence_false_values(self): "anchoreEnterpriseFeeds.persistence.resourcePolicy": None } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'persistence': { 'enabled': False, @@ -500,7 +500,7 @@ def test_anchoreEnterpriseFeeds_persistence_values(self): "anchoreEnterpriseFeeds.persistence.mountPath": "/workspace" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'persistence': { 'enabled': True, @@ -537,7 +537,9 @@ def test_anchoreEnterpriseFeeds_rhelDriverConcurrency_values(self): } result = replace_keys_with_mappings(dot_string_dict, self.results_dir) - self.assertEqual(result[0], {}) + self.assertEqual(result[0], { + 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}} + }) self.assertEqual(result[1], expected_result) def test_anchoreEnterpriseFeeds_ubuntuDriverGit_values(self): @@ -556,7 +558,9 @@ def test_anchoreEnterpriseFeeds_ubuntuDriverGit_values(self): } result = replace_keys_with_mappings(dot_string_dict, self.results_dir) - self.assertEqual(result[0], {}) + self.assertEqual(result[0], { + 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}} + }) self.assertEqual(result[1], expected_result) # Anchore Feeds DB values @@ -570,7 +574,7 @@ def test_anchoreFeedsDB_values(self): "anchore-feeds-db.postgresPort": 5432 } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, "feeds": { "feeds-db": { "chartEnabled": True, @@ -601,7 +605,7 @@ def test_anchoreFeedsDB_persistence_values(self): "anchore-feeds-db.persistence.size": "20Gi" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'feeds-db': { 'primary': { @@ -624,7 +628,7 @@ def test_anchoreFeedsDB_image_values(self): "anchore-feeds-db.imageTag": "latest" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'feeds-db': { 'image': { @@ -652,7 +656,7 @@ def test_anchoreFeedsDB_extraEnv_values(self): ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'feeds-db':{ 'primary': { @@ -678,7 +682,7 @@ def test_anchoreFeedsGemDB_values(self): "anchore-feeds-gem-db.postgresPort": 5432 } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, "feeds": { "gem-db": { "chartEnabled": True, @@ -709,7 +713,7 @@ def test_anchoreFeedsGemDB_persistence_values(self): "anchore-feeds-gem-db.persistence.size": "20Gi" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'gem-db': { 'primary': { @@ -732,7 +736,7 @@ def test_anchoreFeedsGemDB_image_values(self): "anchore-feeds-gem-db.imageTag": "latest" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'gem-db': { 'image': { @@ -760,7 +764,7 @@ def test_anchoreFeedsGemDB_extraEnv_values(self): ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'feeds': { 'gem-db':{ 'primary': { diff --git a/scripts/tests/test_anchoreEnterpriseNotifications_value_mapping.py b/scripts/tests/test_anchoreEnterpriseNotifications_value_mapping.py index 54b32319..f1264207 100644 --- a/scripts/tests/test_anchoreEnterpriseNotifications_value_mapping.py +++ b/scripts/tests/test_anchoreEnterpriseNotifications_value_mapping.py @@ -17,7 +17,7 @@ def test_anchoreEnterpriseNotifications_enabled_value(self): dot_string_dict = { "anchoreEnterpriseNotifications.enabled": True, # deprecated } - expected_result = {} + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}},} result = replace_keys_with_mappings(dot_string_dict, self.results_dir) self.assertEqual(result[0], expected_result) @@ -25,7 +25,7 @@ def test_anchoreEnterpriseNotifications_replicaCount_value(self): dot_string_dict = { "anchoreEnterpriseNotifications.replicaCount": 2, } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'notifications': { 'replicaCount': 2 } @@ -41,7 +41,7 @@ def test_anchoreEnterpriseNotifications_resources_value(self): "anchoreEnterpriseNotifications.resources.requests.cpu": 1, "anchoreEnterpriseNotifications.resources.requests.memory": "1G" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'notifications': { 'resources': { 'limits': { @@ -65,7 +65,7 @@ def test_anchoreEnterpriseNotifications_labels_value(self): "anchoreEnterpriseNotifications.labels.myOtherLabel": "myOtherValue", "anchoreEnterpriseNotifications.labels.anotherLabel.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'notifications': { 'labels': { @@ -84,7 +84,7 @@ def test_anchoreEnterpriseNotifications_annotations_value(self): "anchoreEnterpriseNotifications.annotations.bar": "baz", "anchoreEnterpriseNotifications.annotations.anotherLabel.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'notifications': { 'annotations': { @@ -104,7 +104,7 @@ def test_anchoreEnterpriseNotifications_deploymentAnnotations_value(self): "anchoreEnterpriseNotifications.deploymentAnnotations.bar": "baz", "anchoreEnterpriseNotifications.deploymentAnnotations.anotherLabel.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'notifications': { 'deploymentAnnotations': { @@ -123,7 +123,7 @@ def test_anchoreEnterpriseNotifications_nodeSelector_value(self): "anchoreEnterpriseNotifications.nodeSelector.value": "bar", "anchoreEnterpriseNotifications.nodeSelector.anotherLabel.with.a.dot": "baz" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'notifications': { 'nodeSelector': { @@ -145,7 +145,7 @@ def test_anchoreEnterpriseNotifications_tolerations_value(self): } ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'notifications': { 'tolerations': [ { @@ -164,7 +164,7 @@ def test_anchoreEnterpriseNotifications_affinity_value(self): "anchoreEnterpriseNotifications.affinity.value": "bar", "anchoreEnterpriseNotifications.affinity.anotherLabel.with.a.dot": "baz" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'notifications': { 'affinity':{ 'name': 'foo', @@ -185,7 +185,7 @@ def test_anchoreEnterpriseNotifications_extraEnv_value(self): } ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'notifications': { 'extraEnv': [ { @@ -202,7 +202,7 @@ def test_anchoreEnterpriseNotifications_serviceAccountName_value(self): dot_string_dict = { "anchoreEnterpriseNotifications.serviceAccountName": "Null" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'notifications': { 'serviceAccountName': "Null" } @@ -221,7 +221,7 @@ def test_anchoreEnterpriseNotifications_service_value(self): "anchoreEnterpriseNotifications.service.annotations.with.a.dot": "quux", "anchoreEnterpriseNotifications.service.labels": {} } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'notifications': { 'service': { "name": "Null", @@ -245,6 +245,7 @@ def test_anchoreEnterpriseNotifications_cycleTimers_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'notifications': { 'cycle_timers': { "notifications": 30 @@ -261,6 +262,7 @@ def test_anchoreEnterpriseNotifications_uiUrl_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'notifications': { 'ui_url': "http://myurl.myurl" } diff --git a/scripts/tests/test_anchoreEnterpriseRbac_value_mapping.py b/scripts/tests/test_anchoreEnterpriseRbac_value_mapping.py index cc7d953d..6c810284 100644 --- a/scripts/tests/test_anchoreEnterpriseRbac_value_mapping.py +++ b/scripts/tests/test_anchoreEnterpriseRbac_value_mapping.py @@ -17,7 +17,7 @@ def test_anchoreEnterpriseRbac_replicaCount_value(self): dot_string_dict = { "anchoreEnterpriseRbac.replicaCount": 2, } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'rbacManager': { 'replicaCount': 2 } @@ -33,7 +33,7 @@ def test_anchoreEnterpriseRbac_resources_value(self): "anchoreEnterpriseRbac.resources.requests.cpu": 1, "anchoreEnterpriseRbac.resources.requests.memory": "1G" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'rbacManager': { 'resources': { 'limits': { @@ -57,7 +57,7 @@ def test_anchoreEnterpriseRbac_labels_value(self): "anchoreEnterpriseRbac.labels.myOtherLabel": "myOtherValue", "anchoreEnterpriseRbac.labels.anotherLabel.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'rbacManager': { 'labels': { @@ -76,7 +76,7 @@ def test_anchoreEnterpriseRbac_annotations_value(self): "anchoreEnterpriseRbac.annotations.bar": "baz", "anchoreEnterpriseRbac.annotations.anotherLabel.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'rbacManager': { 'annotations': { @@ -96,7 +96,7 @@ def test_anchoreEnterpriseRbac_deploymentAnnotations_value(self): "anchoreEnterpriseRbac.deploymentAnnotations.bar": "baz", "anchoreEnterpriseRbac.deploymentAnnotations.anotherLabel.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'rbacManager': { 'deploymentAnnotations': { @@ -115,7 +115,7 @@ def test_anchoreEnterpriseRbac_nodeSelector_value(self): "anchoreEnterpriseRbac.nodeSelector.value": "bar", "anchoreEnterpriseRbac.nodeSelector.anotherLabel.with.a.dot": "baz" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'rbacManager': { 'nodeSelector': { @@ -137,7 +137,7 @@ def test_anchoreEnterpriseRbac_tolerations_value(self): } ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'rbacManager': { 'tolerations': [ { @@ -156,7 +156,7 @@ def test_anchoreEnterpriseRbac_affinity_value(self): "anchoreEnterpriseRbac.affinity.value": "bar", "anchoreEnterpriseRbac.affinity.anotherLabel.with.a.dot": "baz" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'rbacManager': { 'affinity':{ 'name': 'foo', @@ -177,7 +177,7 @@ def test_anchoreEnterpriseRbac_extraEnv_value(self): } ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'rbacManager': { 'extraEnv': [ { @@ -203,7 +203,7 @@ def test_anchoreEnterpriseRbac_serviceAccountName_value(self): dot_string_dict = { "anchoreEnterpriseRbac.serviceAccountName": "Null" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'rbacManager': { 'serviceAccountName': "Null" } @@ -223,7 +223,7 @@ def test_anchoreEnterpriseRbac_service_value(self): "anchoreEnterpriseRbac.service.annotations.anotherLabel.with.a.dot": "qux", "anchoreEnterpriseRbac.service.labels": {}, } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'rbacManager': { 'service': { 'name': 'Null', @@ -248,7 +248,7 @@ def test_anchoreEnterpriseRbac_enabled_value(self): dot_string_dict = { "anchoreEnterpriseRbac.enabled": True # deprecated } - expected_result = {} + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}},} result = replace_keys_with_mappings(dot_string_dict, self.results_dir) self.assertEqual(result[0], expected_result) @@ -260,7 +260,7 @@ def test_anchoreEnterpriseRbac_authResources_value(self): "anchoreEnterpriseRbac.authResources.requests.cpu": "100m", "anchoreEnterpriseRbac.authResources.requests.memory": "256M" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'rbacAuth': { 'resources': { 'limits': { @@ -284,7 +284,7 @@ def test_anchoreEnterpriseRbac_managerResources_value(self): "anchoreEnterpriseRbac.managerResources.requests.cpu": "100m", "anchoreEnterpriseRbac.managerResources.requests.memory": "256M" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'rbacManager': { 'resources': { 'limits': { diff --git a/scripts/tests/test_anchoreEnterpriseReports_value_mapping.py b/scripts/tests/test_anchoreEnterpriseReports_value_mapping.py index 207c40cb..d1fe1922 100644 --- a/scripts/tests/test_anchoreEnterpriseReports_value_mapping.py +++ b/scripts/tests/test_anchoreEnterpriseReports_value_mapping.py @@ -17,7 +17,7 @@ def test_anchoreEnterpriseReports_enabled_value(self): dot_string_dict = { "anchoreEnterpriseReports.enabled": True, # deprecated } - expected_result = {} + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}},} result = replace_keys_with_mappings(dot_string_dict, self.results_dir) self.assertEqual(result[0], expected_result) @@ -25,7 +25,7 @@ def test_anchoreEnterpriseReports_replicaCount_value(self): dot_string_dict = { "anchoreEnterpriseReports.replicaCount": 2, } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'reports': { 'replicaCount': 2 } @@ -41,7 +41,7 @@ def test_anchoreEnterpriseReports_resources_value(self): "anchoreEnterpriseReports.resources.requests.cpu": 1, "anchoreEnterpriseReports.resources.requests.memory": "1G" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'reports': { 'resources': { 'limits': { @@ -65,7 +65,7 @@ def test_anchoreEnterpriseReports_labels_value(self): "anchoreEnterpriseReports.labels.myOtherLabel": "myOtherValue", "anchoreEnterpriseReports.labels.anotherLabel.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'reports': { 'labels': { @@ -84,7 +84,7 @@ def test_anchoreEnterpriseReports_annotations_value(self): "anchoreEnterpriseReports.annotations.bar": "baz", "anchoreEnterpriseReports.annotations.anotherLabel.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'reports': { 'annotations': { @@ -104,7 +104,7 @@ def test_anchoreEnterpriseReports_deploymentAnnotations_value(self): "anchoreEnterpriseReports.deploymentAnnotations.bar": "baz", "anchoreEnterpriseReports.deploymentAnnotations.anotherLabel.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'reports': { 'deploymentAnnotations': { @@ -123,7 +123,7 @@ def test_anchoreEnterpriseReports_nodeSelector_value(self): "anchoreEnterpriseReports.nodeSelector.value": "bar", "anchoreEnterpriseReports.nodeSelector.anotherLabel.with.a.dot": "baz" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'reports': { 'nodeSelector': { @@ -145,7 +145,7 @@ def test_anchoreEnterpriseReports_tolerations_value(self): } ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'reports': { 'tolerations': [ { @@ -164,7 +164,7 @@ def test_anchoreEnterpriseReports_affinity_value(self): "anchoreEnterpriseReports.affinity.value": "bar", "anchoreEnterpriseReports.affinity.anotherLabel.with.a.dot": "baz" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'reports': { 'affinity':{ 'name': 'foo', @@ -180,7 +180,7 @@ def test_anchoreEnterpriseReports_extraEnv_value(self): dot_string_dict = { "anchoreEnterpriseReports.extraEnv": [] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'reports': { 'extraEnv': [] } @@ -192,7 +192,7 @@ def test_anchoreEnterpriseReports_serviceAccountName_value(self): dot_string_dict = { "anchoreEnterpriseReports.serviceAccountName": "" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'reports': { 'serviceAccountName': "" } @@ -211,7 +211,7 @@ def test_anchoreEnterpriseReports_service_value(self): "anchoreEnterpriseReports.service.labels.foobar": "baz", "anchoreEnterpriseReports.service.labels.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'reports': { 'service': { "name": "Null", @@ -234,6 +234,7 @@ def test_anchoreEnterpriseReports_enableGraphiql_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'reports': { 'enable_graphiql': True } @@ -248,6 +249,7 @@ def test_anchoreEnterpriseReports_enableDataIngress_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'reports_worker': { 'enable_data_ingress': True } @@ -262,6 +264,7 @@ def test_anchoreEnterpriseReports_enableDataEgress_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'reports_worker': { 'enable_data_egress': False } @@ -276,6 +279,7 @@ def test_anchoreEnterpriseReports_dataEgressWindow_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'reports_worker': { 'data_egress_window': 1 } @@ -290,6 +294,7 @@ def test_anchoreEnterpriseReports_dataRefreshMaxWorkers_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'reports_worker': { 'data_refresh_max_workers': 1 } @@ -304,6 +309,7 @@ def test_anchoreEnterpriseReports_dataLoadMaxWorkers_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'reports_worker': { 'data_load_max_workers': 1 } @@ -321,6 +327,7 @@ def test_anchoreEnterpriseReports_cycleTimers_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'reports_worker': { 'cycle_timers': { 'reports_data_load': 600, diff --git a/scripts/tests/test_anchoreEnterpriseUi_value_mapping.py b/scripts/tests/test_anchoreEnterpriseUi_value_mapping.py index 42cdb6f4..814eb997 100644 --- a/scripts/tests/test_anchoreEnterpriseUi_value_mapping.py +++ b/scripts/tests/test_anchoreEnterpriseUi_value_mapping.py @@ -17,7 +17,7 @@ def test_anchoreEnterpriseUi_enabled_value(self): dot_string_dict = { "anchoreEnterpriseUi.enabled": True, # deprecated } - expected_result = {} + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}},} result = replace_keys_with_mappings(dot_string_dict, self.results_dir) self.assertEqual(result[0], expected_result) @@ -26,7 +26,7 @@ def test_anchoreEnterpriseUi_image_value(self): "anchoreEnterpriseUi.image": "docker.io/anchore/enterprise-ui:v5.0.0", "anchoreEnterpriseUi.imagePullPolicy": "IfNotPresent" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'ui': { 'image': "docker.io/anchore/enterprise-ui:v5.0.0", 'imagePullPolicy': "IfNotPresent" @@ -39,7 +39,7 @@ def test_anchoreEnterpriseUi_replicaCount_value(self): dot_string_dict = { "anchoreEnterpriseUi.replicaCount": 2, } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'ui': { 'replicaCount': 2 } @@ -55,7 +55,7 @@ def test_anchoreEnterpriseUi_resources_value(self): "anchoreEnterpriseUi.resources.requests.cpu": 1, "anchoreEnterpriseUi.resources.requests.memory": "1G" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'ui': { 'resources': { 'limits': { @@ -79,7 +79,7 @@ def test_anchoreEnterpriseUi_labels_value(self): "anchoreEnterpriseUi.labels.myOtherLabel": "myOtherValue", "anchoreEnterpriseUi.labels.anotherLabel.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'ui': { 'labels': { @@ -98,7 +98,7 @@ def test_anchoreEnterpriseUi_annotations_value(self): "anchoreEnterpriseUi.annotations.bar": "baz", "anchoreEnterpriseUi.annotations.anotherLabel.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'ui': { 'annotations': { @@ -118,7 +118,7 @@ def test_anchoreEnterpriseUi_deploymentAnnotations_value(self): "anchoreEnterpriseUi.deploymentAnnotations.bar": "baz", "anchoreEnterpriseUi.deploymentAnnotations.anotherLabel.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'ui': { 'deploymentAnnotations': { @@ -137,7 +137,7 @@ def test_anchoreEnterpriseUi_nodeSelector_value(self): "anchoreEnterpriseUi.nodeSelector.value": "bar", "anchoreEnterpriseUi.nodeSelector.anotherLabel.with.a.dot": "baz" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'ui': { 'nodeSelector': { @@ -159,7 +159,7 @@ def test_anchoreEnterpriseUi_tolerations_value(self): } ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'ui': { 'tolerations': [ { @@ -178,7 +178,7 @@ def test_anchoreEnterpriseUi_affinity_value(self): "anchoreEnterpriseUi.affinity.value": "bar", "anchoreEnterpriseUi.affinity.anotherLabel.with.a.dot": "baz" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'ui': { 'affinity':{ 'name': 'foo', @@ -202,7 +202,7 @@ def test_anchoreEnterpriseUi_extraEnv_value(self): } ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'ui': { 'extraEnv': [ { @@ -222,7 +222,7 @@ def test_anchoreEnterpriseUi_serviceAccountName_value(self): dot_string_dict = { "anchoreEnterpriseUi.serviceAccountName": "Null" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'ui': { 'serviceAccountName': "Null" } @@ -242,7 +242,7 @@ def test_anchoreEnterpriseUi_service_value(self): "anchoreEnterpriseUi.service.labels": {}, "anchoreEnterpriseUi.service.sessionAffinity": "ClientIP" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'ui': { 'service': { "name": "Null", @@ -266,7 +266,7 @@ def test_anchoreEnterpriseUi_db_value(self): "anchoreEnterpriseUi.dbUser": "anchoreengineui", "anchoreEnterpriseUi.dbPass": "anchore-postgres,123ui" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'ui': { 'dbUser': "anchoreengineui", 'dbPass': "anchore-postgres,123ui" @@ -285,6 +285,7 @@ def test_anchoreEnterpriseUi_appDBConfig_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'ui': { 'appdb_config': { 'native': True, @@ -305,7 +306,7 @@ def test_anchoreEnterpriseUi_ldapsRootCaCertName_value(self): dot_string_dict = { "anchoreEnterpriseUi.ldapsRootCaCertName": "Null" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'ui': { 'ldapsRootCaCertName': "Null" } @@ -319,6 +320,7 @@ def test_anchoreEnterpriseUi_logLevel_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'ui': { 'log_level': "http" } @@ -333,6 +335,7 @@ def test_anchoreEnterpriseUi_enableProxy_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'ui': { 'enable_proxy': False } @@ -347,6 +350,7 @@ def test_anchoreEnterpriseUi_enableSsl_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'ui': { 'enable_ssl': False } @@ -361,6 +365,7 @@ def test_anchoreEnterpriseUi_enableSharedLogin_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'ui': { 'enable_shared_login': True } @@ -375,6 +380,7 @@ def test_anchoreEnterpriseUi_redisFlushdb_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'ui': { 'redis_flushdb': True } @@ -389,6 +395,7 @@ def test_anchoreEnterpriseUi_forceWebsocket_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'ui': { 'force_websocket': False } @@ -404,6 +411,7 @@ def test_anchoreEnterpriseUi_authenticationLock_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'ui': { 'authentication_lock': { 'count': 5, @@ -431,6 +439,7 @@ def test_anchoreEnterpriseUi_customLinks_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'ui': { 'custom_links': { 'title': "Custom External Links", @@ -458,6 +467,7 @@ def test_anchoreEnterpriseUi_enableAddRepositories_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'ui': { 'enable_add_repositories': { 'admin': True, @@ -475,6 +485,7 @@ def test_anchoreEnterpriseUi_enrichInventoryView_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'ui': { 'enrich_inventory_view': True } @@ -488,6 +499,7 @@ def test_uiRedis_auth_password_value(self): "ui-redis.auth.password": "anchore-redis,123" } expected_result = { + 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'ui-redis': { 'auth': { 'password': "anchore-redis,123" @@ -501,7 +513,7 @@ def test_uiRedis_architecture_value(self): dot_string_dict = { "ui-redis.architecture": "standalone" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'ui-redis': { 'architecture': "standalone" } @@ -513,7 +525,7 @@ def test_uiRedis_master_persistence_enabled_value(self): dot_string_dict = { "ui-redis.master.persistence.enabled": False } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'ui-redis': { 'master': { 'persistence': { @@ -529,7 +541,7 @@ def test_uiRedis_enabled_value(self): dot_string_dict = { "ui-redis.enabled": False } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'ui-redis': { 'chartEnabled': False } @@ -541,7 +553,7 @@ def test_uiRedis_externalEndpoint_value(self): dot_string_dict = { "ui-redis.externalEndpoint": "my-redis-place.someplace" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'ui-redis': { 'externalEndpoint': "my-redis-place.someplace" } diff --git a/scripts/tests/test_anchoreGlobal_value_mapping.py b/scripts/tests/test_anchoreGlobal_value_mapping.py index 37c63f20..7dc02732 100644 --- a/scripts/tests/test_anchoreGlobal_value_mapping.py +++ b/scripts/tests/test_anchoreGlobal_value_mapping.py @@ -17,7 +17,7 @@ def tearDown(self): def test_fullnameOverride(self): dot_string_dict = {"fullnameOverride": "overridden"} - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'fullnameOverride': 'overridden' } result = replace_keys_with_mappings(dot_string_dict, self.results_dir) @@ -36,7 +36,7 @@ def test_postgresql_values(self): "postgresql.extraEnv": [{'name': 'POSTGRES_USER', 'value': 'myuser'}, {'name': 'POSTGRES_PASSWORD', 'value': 'mypass'}], } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'postgresql':{ 'chartEnabled': True, 'auth':{ @@ -79,7 +79,7 @@ def test_cloudsql_values(self): "cloudsql.image.tag": "1.11", "cloudsql.image.pullPolicy": "Always", } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'cloudsql': { 'enabled': True, 'extraArgs': ['--max_connections=1000'], @@ -118,7 +118,7 @@ def test_ingress_values(self): ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'ingress': { 'enabled': False, 'apiPath': '/v1/', @@ -159,7 +159,7 @@ def test_anchoreGlobal_image_values(self): "anchoreEnterpriseGlobal.enabled": True, "anchoreEnterpriseGlobal.licenseSecretName": "my-anchore-enterprise-license" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'image': 'my.repo/anchore-enterprise:v4.9.0', 'imagePullPolicy': 'ifNotPresent', 'imagePullSecretName': 'enterprise-pull-secret', @@ -174,7 +174,7 @@ def test_anchoreGlobal_openShiftDeployment_value(self): dot_string_dict = { "openShiftDeployment": True, } - expected_result = {} + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}},} result = replace_keys_with_mappings(dot_string_dict, self.results_dir) self.assertEqual(result[0], expected_result) self.assertEqual(result[1], {}) @@ -183,7 +183,7 @@ def test_anchoreGlobal_serviceAccountName_value(self): dot_string_dict = { "anchoreGlobal.serviceAccountName": "my-sa-anchore-engine", } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'serviceAccountName': 'my-sa-anchore-engine' } result = replace_keys_with_mappings(dot_string_dict, self.results_dir) @@ -195,7 +195,7 @@ def test_anchoreGlobal_labels_value(self): "anchoreGlobal.labels.mylabel": "myvalue", "anchoreGlobal.labels.myotherlabel": "myothervalue", } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'labels': { 'mylabel': 'myvalue', 'myotherlabel': 'myothervalue' @@ -210,7 +210,7 @@ def test_anchoreGlobal_annotations_value(self): "anchoreGlobal.annotations.myannotation": "myvalue", "anchoreGlobal.annotations.myotherannotation": "myothervalue", } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'annotations': { 'myannotation': 'myvalue', 'myotherannotation': 'myothervalue' @@ -227,7 +227,7 @@ def test_anchoreGlobal_extraEnv_value(self): {"name": "MY_OTHER_ENV_VAR", "value": "myothervalue"} ], } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'extraEnv': [ {'name': 'MY_ENV_VAR', 'value': 'myvalue'}, {'name': 'MY_OTHER_ENV_VAR', 'value': 'myothervalue'} @@ -243,7 +243,7 @@ def test_anchoreGlobal_deploymentAnnotations_value(self): "anchoreGlobal.deploymentAnnotations.myannotation": "myvalue", "anchoreGlobal.deploymentAnnotations.myotherannotation": "myothervalue", } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'deploymentAnnotations': { 'myannotation': 'myvalue', 'myotherannotation': 'myothervalue' @@ -261,7 +261,7 @@ def test_anchoreGlobal_useExistingSecret_value(self): "anchoreEnterpriseFeeds.existingSecretName": "my-existing-secret-feeds", } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'useExistingSecret': True, 'existingSecretName': 'my-existing-secret', 'ui': { @@ -283,7 +283,7 @@ def test_anchoreGlobal_doSourceAtEntry_value(self): "anchoreGlobal.doSourceAtEntry.enabled": True, "anchoreGlobal.doSourceAtEntry.filePaths": ["/vault/secrets/config"], } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'doSourceAtEntry': { 'enabled': True, 'filePaths': ['/vault/secrets/config'] @@ -304,7 +304,7 @@ def test_anchoreGlobal_extraVolumes_value(self): } ], } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'extraVolumes': [ { 'name': 'config', @@ -329,7 +329,7 @@ def test_anchoreGlobal_extraVolumeMounts_value(self): } ], } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'extraVolumeMounts': [ { 'name': 'config', @@ -349,7 +349,7 @@ def test_anchoreGlobal_scratchVolume_value(self): "anchoreGlobal.scratchVolume.mountPath": "/analysis_scratch", "anchoreGlobal.scratchVolume.details": {}, } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'scratchVolume': { 'fixGroupPermissions': False, 'mountPath': '/analysis_scratch', @@ -364,7 +364,7 @@ def test_anchoreGlobal_certStoreSecretName_value(self): dot_string_dict = { "anchoreGlobal.certStoreSecretName": "my-cert-store-secret", } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'certStoreSecretName': 'my-cert-store-secret' } result = replace_keys_with_mappings(dot_string_dict, self.results_dir) @@ -377,7 +377,7 @@ def test_anchoreGlobal_securityContext_value(self): "anchoreGlobal.securityContext.runAsGroup": 1000, "anchoreGlobal.securityContext.fsGroup": 1000, } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'securityContext': { 'runAsUser': 1000, 'runAsGroup': 1000, @@ -393,7 +393,7 @@ def test_anchoreGlobal_containerSecurityContext_value(self): "anchoreGlobal.containerSecurityContext.securityContext.runAsGroup": 1000, "anchoreGlobal.containerSecurityContext.securityContext.fsGroup": 1000, } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'containerSecurityContext': { 'securityContext': { 'runAsUser': 1000, @@ -411,6 +411,7 @@ def test_anchoreGlobal_serviceDir_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'service_dir': '/anchore_service' } } @@ -423,6 +424,7 @@ def test_anchoreGlobal_logLevel_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'log_level': 'INFO' } } @@ -434,7 +436,7 @@ def test_anchoreGlobal_imageAnalyzeTimeoutSeconds_value(self): dot_string_dict = { "anchoreGlobal.imageAnalyzeTimeoutSeconds": 100, } - expected_result = {} + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}},} result = replace_keys_with_mappings(dot_string_dict, self.results_dir) self.assertEqual(result[0], expected_result) @@ -444,6 +446,7 @@ def test_anchoreGlobal_allowECRUseIAMRole_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'allow_awsecr_iam_auto': True } } @@ -456,6 +459,7 @@ def test_anchoreGlobal_enableMetrics_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'metrics': { 'enabled': False } @@ -470,6 +474,7 @@ def test_anchoreGlobal_metricsAuthDisabled_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'metrics': { 'auth_disabled': True } @@ -485,6 +490,7 @@ def test_anchoreGlobal_defaultAdmin_value(self): } expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'default_admin_password': 'myadminpassword', 'default_admin_email': 'myadminemail@email.com' } @@ -507,6 +513,7 @@ def test_anchoreGlobal_saml_values(self): expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'keys': { 'secret': 'my-saml-secret', 'privateKeyFileName': 'my-private-key-name', @@ -515,7 +522,6 @@ def test_anchoreGlobal_saml_values(self): } } - result = replace_keys_with_mappings(dot_string_dict, self.results_dir) self.assertEqual(result[0], expected_result) @@ -528,6 +534,7 @@ def test_anchoreGlobal_oauth_values(self): expected_result = { 'anchoreConfig': { 'user_authentication': { + 'hashed_passwords': False, 'oauth': { 'enabled': True, 'default_token_expiration_seconds': 100, @@ -546,6 +553,7 @@ def test_anchoreGlobal_ssoRequireExistingUsers_value(self): expected_result = { 'anchoreConfig': { 'user_authentication': { + 'hashed_passwords': False, 'sso_require_existing_users': True } } @@ -580,6 +588,7 @@ def test_anchoreGlobal_dbConfig_values(self): expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'database': { 'timeout': 100, 'ssl': True, @@ -606,6 +615,7 @@ def test_anchoreGlobal_internalServicesSsl_values(self): expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'internalServicesSSL': { 'certSecretCertFileName': 'my-cert-secret-cert-name', 'certSecretKeyFileName': 'my-cert-secret-key-name', @@ -629,6 +639,7 @@ def test_anchoreGlobal_webhooks_values(self): expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'webhooks': { 'ssl_verify': False, 'url': 'http://somehost:9090//', @@ -648,6 +659,7 @@ def test_anchoreGlobal_policyBundles_values(self): expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'policyBundles': { 'custom_policy_bundle1': { 'json': '{\n "id": "custom1",\n "version": "1_0",\n "name": "My custom bundle",\n "comment": "My system\'s custom bundle",\n "whitelisted_images": [],\n "blacklisted_images": [],\n "mappings": [],\n "whitelists": [],\n "policies": []\n}\n' @@ -672,7 +684,7 @@ def test_anchoreGlobal_probes_values(self): "anchoreGlobal.probes.readiness.successThreshold": 1, } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'probes': { 'liveness': { 'failureThreshold': 6, @@ -697,7 +709,7 @@ def test_anchoreGlobal_inject_secrets_via_env_value(self): dot_string_dict = { "inject_secrets_via_env": True, } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'injectSecretsViaEnv': True } result = replace_keys_with_mappings(dot_string_dict, self.results_dir) @@ -706,7 +718,7 @@ def test_anchoreGlobal_inject_secrets_via_env_value(self): # def test_replace_keys_with_mappings_env_var(self): # dot_string_dict = {"anchoreApi.maxRequestThreads": 999} - # expected_result = { + # expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, # 'api': # {'extraEnv': [ # {'name': 'ANCHORE_MAX_REQUEST_THREADS', 'value': 999} @@ -718,7 +730,7 @@ def test_anchoreGlobal_inject_secrets_via_env_value(self): # def test_replace_keys_with_mappings(self): # dot_string_dict = {"anchore-feeds-db.persistence.size": 100} - # expected_result = { + # expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, # "feeds": { # "feeds-db": { # "primary": { @@ -737,7 +749,7 @@ def test_anchoreGlobal_serverRequestTimeout_value(self): dot_string_dict = { "anchoreGlobal.serverRequestTimeout": 300, } - expected_result = {} + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}},} result = replace_keys_with_mappings(dot_string_dict, self.results_dir) self.assertEqual(result[0], expected_result) @@ -752,6 +764,25 @@ def test_anchoreGlobal_serverRequestTimeout_value(self): } self.assertEqual(result[1], expected_env_result) + def test_anchoreGlobal_maxCompressedImageSizeMB_value(self): + dot_string_dict = { + "anchoreGlobal.maxCompressedImageSizeMB": 700 + } + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, + } + + expected_env_result = { + 'extraEnv': + [ + { + 'name': 'ANCHORE_MAX_COMPRESSED_IMAGE_SIZE_MB', + 'value': 700 + } + ] + } + result = replace_keys_with_mappings(dot_string_dict, self.results_dir) + self.assertEqual(result[1], expected_env_result) + if __name__ == '__main__': unittest.main() \ No newline at end of file diff --git a/scripts/tests/test_anchorePolicyEngine_value_mapping.py b/scripts/tests/test_anchorePolicyEngine_value_mapping.py index 904166f2..67f1a18c 100644 --- a/scripts/tests/test_anchorePolicyEngine_value_mapping.py +++ b/scripts/tests/test_anchorePolicyEngine_value_mapping.py @@ -17,7 +17,7 @@ def test_anchorePolicyEngine_replicaCount_value(self): dot_string_dict = { "anchorePolicyEngine.replicaCount": 2, } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'policyEngine': { 'replicaCount': 2 } @@ -33,7 +33,7 @@ def test_anchorePolicyEngine_resources_value(self): "anchorePolicyEngine.resources.requests.cpu": 1, "anchorePolicyEngine.resources.requests.memory": "1G" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'policyEngine': { 'resources': { 'limits': { @@ -55,7 +55,7 @@ def test_anchorePolicyEngine_labels_value(self): "anchorePolicyEngine.labels.foobar": "baz", "anchorePolicyEngine.labels.with.a.dot.foobar": "baz" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'policyEngine': { 'labels': { @@ -72,7 +72,7 @@ def test_anchorePolicyEngine_annotations_value(self): "anchorePolicyEngine.annotations.foobar": "baz", "anchorePolicyEngine.annotations.with.a.dot.foobar": "baz" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'policyEngine': { 'annotations': { @@ -89,7 +89,7 @@ def test_anchorePolicyEngine_deploymentAnnotations_value(self): "anchorePolicyEngine.deploymentAnnotations.foobar": "baz", "anchorePolicyEngine.deploymentAnnotations.with.a.dot.foobar": "baz" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'policyEngine': { 'deploymentAnnotations': { 'foobar': 'baz', @@ -105,7 +105,7 @@ def test_anchorePolicyEngine_nodeSelector_value(self): "anchorePolicyEngine.nodeSelector.name": "foo", "anchorePolicyEngine.nodeSelector.with.a.dot.name": "bar" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'policyEngine': { 'nodeSelector': { 'name': 'foo', @@ -127,7 +127,7 @@ def test_anchorePolicyEngine_tolerations_value(self): } ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'policyEngine': { 'tolerations': [ { @@ -147,7 +147,7 @@ def test_anchorePolicyEngine_affinity_value(self): "anchorePolicyEngine.affinity.name": "foo", "anchorePolicyEngine.affinity.with.a.dot.name": "bar" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'policyEngine': { 'affinity': { @@ -168,7 +168,7 @@ def test_anchorePolicyEngine_extraEnv_value(self): } ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'policyEngine': { 'extraEnv': [ { @@ -185,7 +185,7 @@ def test_anchorePolicyEngine_serviceAccountName_value(self): dot_string_dict = { "anchorePolicyEngine.serviceAccountName": "Null" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'policyEngine': { 'serviceAccountName': "Null" } @@ -205,7 +205,7 @@ def test_anchorePolicyEngine_service_value(self): "anchorePolicyEngine.service.labels.with.a.dot": "qux", } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'policyEngine': { 'service': { "name": "Null", @@ -234,6 +234,7 @@ def test_anchorePolicyEngine_cycleTimers_value(self): expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'policy_engine': { 'cycle_timers': { "feed_sync": 14400, @@ -253,6 +254,7 @@ def test_anchorePolicyEngine_overrideFeedsToUpstream_value(self): expected_result = { 'anchoreConfig': { + 'user_authentication': {'hashed_passwords': False}, 'policy_engine': { 'overrideFeedsToUpstream': True } diff --git a/scripts/tests/test_anchoreSimpleQueue_value_mapping.py b/scripts/tests/test_anchoreSimpleQueue_value_mapping.py index 1f9312bf..5fb35a48 100644 --- a/scripts/tests/test_anchoreSimpleQueue_value_mapping.py +++ b/scripts/tests/test_anchoreSimpleQueue_value_mapping.py @@ -17,7 +17,7 @@ def test_anchoreSimpleQueue_replicaCount_value(self): dot_string_dict = { "anchoreSimpleQueue.replicaCount": 2, } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'simpleQueue': { 'replicaCount': 2 } @@ -33,7 +33,7 @@ def test_anchoreSimpleQueue_resources_value(self): "anchoreSimpleQueue.resources.requests.cpu": 1, "anchoreSimpleQueue.resources.requests.memory": "1G" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'simpleQueue': { 'resources': { 'limits': { @@ -57,7 +57,7 @@ def test_anchoreSimpleQueue_labels_value(self): "anchoreSimpleQueue.labels.myOtherLabel": "myOtherValue", "anchoreSimpleQueue.labels.anotherLabel.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'simpleQueue': { 'labels': { @@ -76,7 +76,7 @@ def test_anchoreSimpleQueue_annotations_value(self): "anchoreSimpleQueue.annotations.bar": "baz", "anchoreSimpleQueue.annotations.anotherLabel.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'simpleQueue': { 'annotations': { @@ -96,7 +96,7 @@ def test_anchoreSimpleQueue_deploymentAnnotations_value(self): "anchoreSimpleQueue.deploymentAnnotations.bar": "baz", "anchoreSimpleQueue.deploymentAnnotations.anotherLabel.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'simpleQueue': { 'deploymentAnnotations': { @@ -115,7 +115,7 @@ def test_anchoreSimpleQueue_nodeSelector_value(self): "anchoreSimpleQueue.nodeSelector.value": "bar", "anchoreSimpleQueue.nodeSelector.anotherLabel.with.a.dot": "baz" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'simpleQueue': { 'nodeSelector': { @@ -137,7 +137,7 @@ def test_anchoreSimpleQueue_tolerations_value(self): } ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'simpleQueue': { 'tolerations': [ { @@ -156,7 +156,7 @@ def test_anchoreSimpleQueue_affinity_value(self): "anchoreSimpleQueue.affinity.value": "bar", "anchoreSimpleQueue.affinity.anotherLabel.with.a.dot": "baz" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'simpleQueue': { 'affinity':{ 'name': 'foo', @@ -177,7 +177,7 @@ def test_anchoreSimpleQueue_extraEnv_value(self): } ] } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'simpleQueue': { 'extraEnv': [ { @@ -194,7 +194,7 @@ def test_anchoreSimpleQueue_serviceAccountName_value(self): dot_string_dict = { "anchoreSimpleQueue.serviceAccountName": "Null" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'simpleQueue': { 'serviceAccountName': "Null" } @@ -214,7 +214,7 @@ def test_anchoreSimpleQueue_service_value(self): "anchoreSimpleQueue.service.labels.foobar": "baz", "anchoreSimpleQueue.service.labels.with.a.dot": "qux" } - expected_result = { + expected_result = { 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, 'simpleQueue': { 'service': { "name": "Null", diff --git a/scripts/tests/test_helpers.py b/scripts/tests/test_helpers.py index 1aded896..f312a372 100644 --- a/scripts/tests/test_helpers.py +++ b/scripts/tests/test_helpers.py @@ -284,6 +284,7 @@ def test_replace_keys_with_mappings(self): dot_string_dict = {"anchore-feeds-db.persistence.size": 100} expected_result = { + 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, "feeds": { "feeds-db": { "primary": { @@ -309,5 +310,10 @@ def test_replace_keys_with_mappings_env_var(self): result = replace_keys_with_mappings(dot_string_dict, self.results_dir) self.assertEqual(result[1], expected_result) + anchore_config_expected_results = { + 'anchoreConfig': {'user_authentication': {'hashed_passwords': False}}, + } + self.assertEqual(result[0], anchore_config_expected_results) + if __name__ == '__main__': unittest.main() \ No newline at end of file