Skip to content

Commit

Permalink
fixing or disabling Upload tests until #10609 is done
Browse files Browse the repository at this point in the history
  • Loading branch information
radeusgd committed Jul 19, 2024
1 parent 630e853 commit c496d61
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions test/Table_Tests/src/Database/Upload_Spec.enso
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ database_table_builder name_prefix args primary_key=[] connection =
database, so features relying on persistence cannot really be tested.
add_specs suite_builder setup make_new_connection persistent_connector=True =
prefix = setup.prefix

snowflake_pending = if prefix.contains "Snowflake" then "Table Upload / Update is not yet fully implemented for Snowflake backend. TODO: https://github.com/enso-org/enso/issues/10609"
data = Data.setup make_new_connection
suite_builder.group prefix+"(Upload_Spec) Creating an empty table" group_builder->
group_builder.specify "should allow to specify the column names and types" <|
Expand Down Expand Up @@ -336,7 +336,7 @@ add_specs suite_builder setup make_new_connection persistent_connector=True =
tmp_connection.close
data.connection.query (SQL_Query.Table_Name name) . at "X" . to_vector . should_equal_ignoring_order [1, 2, 3]

group_builder.specify "should not create any table if upload fails" <|
group_builder.specify "should not create any table if upload fails" pending=snowflake_pending <|
normal_column = Column.from_vector "Y" ((100+0).up_to (100+1000)).to_vector
exploding_column = make_mock_column "X" (0.up_to 1000).to_vector 512
exploding_table = Table.new [normal_column, exploding_column]
Expand Down Expand Up @@ -371,7 +371,7 @@ add_specs suite_builder setup make_new_connection persistent_connector=True =
r1 = data.in_memory_table.select_into_database_table data.connection (Name_Generator.random_name "primary-key-4") primary_key=["X", "nonexistent"]
r1.should_fail_with Missing_Input_Columns

group_builder.specify "should fail if the primary key is not unique" <|
group_builder.specify "should fail if the primary key is not unique" pending=snowflake_pending <|
t1 = Table.new [["X", [1, 2, 1]], ["Y", ['b', 'b', 'a']]]

run_with_and_without_output <|
Expand Down Expand Up @@ -525,7 +525,7 @@ add_specs suite_builder setup make_new_connection persistent_connector=True =
r1 = db_table.select_into_database_table data.connection (Name_Generator.random_name "copied-table") temporary=True primary_key=["nonexistent"]
r1.should_fail_with Missing_Input_Columns

group_builder.specify "should fail when the primary key is not unique" <|
group_builder.specify "should fail when the primary key is not unique" pending=snowflake_pending <|
t = Table.new [["X", [1, 2, 1]], ["Y", ['b', 'b', 'a']]]
db_table = t.select_into_database_table data.connection (Name_Generator.random_name "source-table") temporary=True primary_key=Nothing
Problems.assume_no_problems db_table
Expand Down Expand Up @@ -748,6 +748,7 @@ add_specs suite_builder setup make_new_connection persistent_connector=True =


test_table_append group_builder (data : Data) source_table_builder target_table_builder =
snowflake_pending = if group_builder.name.contains "Snowflake" then "Table Upload / Update is not yet fully implemented for Snowflake backend. TODO: https://github.com/enso-org/enso/issues/10609"
group_builder.specify "should be able to append new rows to a table" <|
dest = target_table_builder [["X", [1, 2, 3]], ["Y", ['a', 'b', 'c']]] primary_key=["X"] connection=data.connection
src = source_table_builder [["X", [4, 5, 6]], ["Y", ['d', 'e', 'f']]] connection=data.connection
Expand Down Expand Up @@ -929,7 +930,7 @@ test_table_append group_builder (data : Data) source_table_builder target_table_
r5 = dest.update_rows src update_action=Update_Action.Align_Records key_columns=[]
r5.should_fail_with Illegal_Argument

group_builder.specify "should fail if the key is not unique in the input table" <|
group_builder.specify "should fail if the key is not unique in the input table" pending=snowflake_pending <|
d1 = target_table_builder [["X", [0, 10, 100]]] primary_key=["X"] connection=data.connection
d2 = target_table_builder [["X", [0, 10, 100]]] connection=data.connection
src = source_table_builder [["X", [1, 1, 3]]] connection=data.connection
Expand Down Expand Up @@ -1095,7 +1096,7 @@ test_table_append group_builder (data : Data) source_table_builder target_table_
r2 = in_memory_table.update_rows t
r2.should_fail_with Illegal_Argument

group_builder.specify "should warn if type widening occurs" <|
group_builder.specify "should warn if type widening occurs" pending=snowflake_pending <|
dest = target_table_builder [["X", [3.25, 4.25, 10.0]]] connection=data.connection
src = source_table_builder [["X", [1, 2, 0]]] connection=data.connection

Expand Down Expand Up @@ -1145,7 +1146,7 @@ test_table_append group_builder (data : Data) source_table_builder target_table_
result = dest.update_rows src update_action=Update_Action.Insert key_columns=[]
result.should_fail_with Column_Type_Mismatch

group_builder.specify "should not leave behind any garbage temporary tables if the upload fails" <|
group_builder.specify "should not leave behind any garbage temporary tables if the upload fails" pending=snowflake_pending <|
dest_name = Name_Generator.random_name "dest-table"
# We will make the upload fail by violating the NOT NULL constraint.
dest = data.connection.create_table dest_name [Column_Description.Value "X" Value_Type.Integer [Column_Constraint.Not_Null]] temporary=True primary_key=[] . should_succeed
Expand Down Expand Up @@ -1354,14 +1355,14 @@ tests group_builder (data : Data) make_new_connection source_table_builder (suff
Problems.expect_only_warning Dry_Run_Operation r1

# The target table is unaffected.
dest.at "X" . to_vector . should_equal v
dest.at "X" . to_vector . should_equal_ignoring_order v

src2 = source_table_builder [["X", [4]]] connection=data.connection
r2 = dest.delete_rows src2 key_columns=["X"] allow_duplicate_matches=True
# 3 rows would be deleted
r2.should_equal 3
Problems.expect_only_warning Dry_Run_Operation r2
dest.at "X" . to_vector . should_equal v
dest.at "X" . to_vector . should_equal_ignoring_order v

if persistent_connector then
group_builder.specify "will not overwrite an existing table with a dry-run table if the name is clashing (select_into_database_table)"+suffix <|
Expand Down

0 comments on commit c496d61

Please sign in to comment.