-
Notifications
You must be signed in to change notification settings - Fork 245
Expand file tree
/
Copy pathtest_secrets_read.py
More file actions
68 lines (60 loc) · 2.78 KB
/
Copy pathtest_secrets_read.py
File metadata and controls
68 lines (60 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import os
from datetime import datetime
from pathlib import Path
from unittest import result
from click.testing import CliRunner
from feathr import (BOOLEAN, FLOAT, INT32, FeatureQuery, ObservationSettings,
SparkExecutionConfiguration, TypedKey, ValueType)
from feathr.client import FeathrClient
from feathr.utils.job_utils import get_result_df
from test_fixture import basic_test_setup
from feathr.constants import OUTPUT_FORMAT
# test parquet file read/write without an extension name
def test_feathr_get_secrets_from_key_vault():
"""
Test if the program can read the key vault secrets as expected
"""
# TODO: need to test get_environment_variable() as well
os.environ['SECRETS__AZURE_KEY_VAULT__NAME'] = 'feathrazuretest3-kv'
# the config below doesn't have `ONLINE_STORE__REDIS__HOST` for testing purpose
yaml_config = """
project_config:
project_name: 'project_feathr_integration_test'
offline_store:
s3:
s3_enabled: true
s3_endpoint: 's3.amazonaws.com'
snowflake:
url: "dqllago-ol19457.snowflakecomputing.com"
user: "feathrintegration"
role: "ACCOUNTADMIN"
spark_config:
spark_cluster: 'databricks'
spark_result_output_parts: '1'
azure_synapse:
dev_url: 'https://feathrazuretest3synapse.dev.azuresynapse.net'
pool_name: 'spark3'
workspace_dir: 'abfss://feathrazuretest3fs@feathrazuretest3storage.dfs.core.windows.net/feathr_test_workspace'
executor_size: 'Small'
executor_num: 1
databricks:
workspace_instance_url: 'https://adb-2474129336842816.16.azuredatabricks.net/'
workspace_token_value: ''
config_template: '{"run_name":"FEATHR_FILL_IN","new_cluster":{"spark_version":"9.1.x-scala2.12","num_workers":1,"spark_conf":{"FEATHR_FILL_IN":"FEATHR_FILL_IN"},"instance_pool_id":"0403-214809-inlet434-pool-l9dj3kwz"},"libraries":[{"jar":"FEATHR_FILL_IN"}],"spark_jar_task":{"main_class_name":"FEATHR_FILL_IN","parameters":["FEATHR_FILL_IN"]}}'
work_dir: 'dbfs:/feathr_getting_started'
feathr_runtime_location: ''
online_store:
redis:
port: 6380
ssl_enabled: True
feature_registry:
purview:
type_system_initialization: false
purview_name: 'feathrazuretest3-purview1'
delimiter: '__'
"""
with open("/tmp/feathr_config.yaml", "w") as text_file:
text_file.write(yaml_config)
client = FeathrClient(config_path="/tmp/feathr_config.yaml")
# `redis_host` should be there since it's not available in the environment variable, and not in the config file, we expect we get it from azure key_vault
assert client.redis_host is not None