Tests passing
This commit is contained in:
parent
922952bf0f
commit
3dfac07cb5
1 changed files with 22 additions and 5 deletions
|
|
@ -2,7 +2,7 @@ from great_expectations.core.expectation_configuration import ExpectationConfigu
|
||||||
|
|
||||||
from lolafect.lolaconfig import build_lolaconfig
|
from lolafect.lolaconfig import build_lolaconfig
|
||||||
from lolafect.data_testing import run_data_test_on_mysql
|
from lolafect.data_testing import run_data_test_on_mysql
|
||||||
from lolafect.connections import open_ssh_tunnel_with_s3_pkey
|
from lolafect.connections import open_ssh_tunnel_with_s3_pkey, close_ssh_tunnel
|
||||||
|
|
||||||
# __ __ _____ _ _ _____ _ _ _____ _
|
# __ __ _____ _ _ _____ _ _ _____ _
|
||||||
# \ \ / /\ | __ \| \ | |_ _| \ | |/ ____| |
|
# \ \ / /\ | __ \| \ | |_ _| \ | |/ ____| |
|
||||||
|
|
@ -33,7 +33,7 @@ def test_validation_on_mysql_succeeds():
|
||||||
),
|
),
|
||||||
ExpectationConfiguration(
|
ExpectationConfiguration(
|
||||||
expectation_type="expect_column_values_to_match_like_pattern",
|
expectation_type="expect_column_values_to_match_like_pattern",
|
||||||
kwargs={"column": "a_string", "like_pattern ": "%lol%"},
|
kwargs={"column": "a_string", "like_pattern": "%lol%"},
|
||||||
),
|
),
|
||||||
ExpectationConfiguration(
|
ExpectationConfiguration(
|
||||||
expectation_type="expect_column_values_to_be_null",
|
expectation_type="expect_column_values_to_be_null",
|
||||||
|
|
@ -60,6 +60,8 @@ def test_validation_on_mysql_succeeds():
|
||||||
expectations=test_expectations
|
expectations=test_expectations
|
||||||
)
|
)
|
||||||
|
|
||||||
|
closed_tunnel = close_ssh_tunnel.run(ssh_tunnel)
|
||||||
|
|
||||||
data_test_passed = validation_result["success"] == True
|
data_test_passed = validation_result["success"] == True
|
||||||
|
|
||||||
assert data_test_passed
|
assert data_test_passed
|
||||||
|
|
@ -78,7 +80,7 @@ def test_validation_on_mysql_fails():
|
||||||
),
|
),
|
||||||
ExpectationConfiguration(
|
ExpectationConfiguration(
|
||||||
expectation_type="expect_column_values_to_match_like_pattern",
|
expectation_type="expect_column_values_to_match_like_pattern",
|
||||||
kwargs={"column": "a_string", "like_pattern ": "%xD%"},
|
kwargs={"column": "a_string", "like_pattern": "%xD%"},
|
||||||
),
|
),
|
||||||
ExpectationConfiguration(
|
ExpectationConfiguration(
|
||||||
expectation_type="expect_column_values_to_not_be_null",
|
expectation_type="expect_column_values_to_not_be_null",
|
||||||
|
|
@ -86,13 +88,28 @@ def test_validation_on_mysql_fails():
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
ssh_tunnel = open_ssh_tunnel_with_s3_pkey.run(
|
||||||
|
s3_bucket_name=TEST_LOLACONFIG.S3_BUCKET_NAME,
|
||||||
|
ssh_tunnel_credentials=TEST_LOLACONFIG.SSH_TUNNEL_CREDENTIALS,
|
||||||
|
remote_target_host=TEST_LOLACONFIG.DW_CREDENTIALS["host"],
|
||||||
|
remote_target_port=TEST_LOLACONFIG.DW_CREDENTIALS["port"],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
validation_result = run_data_test_on_mysql.run(
|
validation_result = run_data_test_on_mysql.run(
|
||||||
name="lolafect-testing-test_validation_on_mysql_fails",
|
name="lolafect-testing-test_validation_on_mysql_fails",
|
||||||
mysql_credentials=TEST_LOLACONFIG.DW_CREDENTIALS,
|
mysql_credentials={
|
||||||
|
"host": ssh_tunnel.local_bind_address[0],
|
||||||
|
"port": ssh_tunnel.local_bind_address[1],
|
||||||
|
"user": TEST_LOLACONFIG.DW_CREDENTIALS["user"],
|
||||||
|
"password": TEST_LOLACONFIG.DW_CREDENTIALS["password"]
|
||||||
|
},
|
||||||
query=test_query,
|
query=test_query,
|
||||||
expectations=test_expectations
|
expectations=test_expectations
|
||||||
)
|
)
|
||||||
|
|
||||||
|
closed_tunnel = close_ssh_tunnel.run(ssh_tunnel)
|
||||||
|
|
||||||
data_test_failed = validation_result["success"] == False
|
data_test_failed = validation_result["success"] == False
|
||||||
|
|
||||||
assert data_test_failed
|
assert data_test_failed
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue