Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sporadic Table_Tests failures caused by reliance on test ordering. #9438

Merged
merged 6 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ add_specs suite_builder setup =
t2.should_fail_with Ambiguous_Column_Rename
err = t2.catch
err.column_name . should_equal "beta"
err.new_names . should_equal ["FirstColumn", "DifferentName!"]
err.new_names.sort . should_equal ["DifferentName!", "FirstColumn"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test probably relied on Map iteration order. (It failed when I changed the iteration order to reproduce the failures.)


group_builder.specify "should correctly handle edge-cases: aliased selectors" <|
t = table_builder [["alpha", [1,2,3]], ["bet", [4,5,6]]]
Expand Down Expand Up @@ -587,7 +587,7 @@ add_specs suite_builder setup =
group_builder.specify "should correctly handle problems: duplicate names" <|
map = ["Test", "Test", "Test", "Test"]
action = data.table.rename_columns map on_problems=_
tester = expect_column_names ["Test 1", "Test 2", "Test 3", "Test"]
tester = expect_column_names ["Test 1", "Test 2", "Test 3", "Test"] ignore_order=True
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test probably relied on Map iteration order. (It failed when I changed the iteration order to reproduce the failures.)

problems = [Duplicate_Output_Column_Names.Error ["Test", "Test", "Test"]]
Problems.test_problem_handling action problems tester

Expand Down
6 changes: 4 additions & 2 deletions test/Table_Tests/src/Common_Table_Operations/Util.enso
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import project.Common_Table_Operations.Main.Test_Setup
import project.Common_Table_Operations.Main.Test_Selection
import project.Common_Table_Operations.Aggregate_Spec

expect_column_names names table =
table.columns . map .name . should_equal names frames_to_skip=2
expect_column_names names table ignore_order=False =
case ignore_order of
False -> table.columns . map .name . should_equal names frames_to_skip=2
True -> table.columns . map .name . sort . should_equal names.sort frames_to_skip=2

type Dummy_Connection
Value
Expand Down
8 changes: 4 additions & 4 deletions test/Table_Tests/src/Database/SQLite_Spec.enso
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,9 @@ type File_Connection

add_specs suite_builder =
in_file_prefix = "[SQLite File] "
# TODO: Add a suite-level teardown to delete this file at the end.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is removed (if it exists) at the start of the test so it's okay if we don't clean it up for now.

# https://github.com/enso-org/enso/issues/9436
# https://github.com/enso-org/enso/issues/9437
database_file = Database_File.create

sqlite_spec suite_builder in_file_prefix (_ -> create_file_connection database_file.file)
Expand All @@ -410,9 +413,6 @@ add_specs suite_builder =
suite_builder.group "SQLite_Format should allow connecting to SQLite files" group_builder->
data = File_Connection.setup database_file

group_builder.teardown <|
data.teardown

group_builder.specify "should recognise a SQLite database file" <|
Auto_Detect.get_reading_format data.file . should_be_a SQLite_Format

Expand Down Expand Up @@ -442,7 +442,7 @@ add_specs suite_builder =
group_builder.specify "should connect to a db file" <|
connection = Data.read data.file
tables = connection.tables
tables.row_count . should_not_equal 0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming here that if this test ever ran first, this line would have failed.

tables.row_count . should_be_a Integer
connection.close

group_builder.specify 'should not duplicate warnings' <|
Expand Down
Loading