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: make order of extracTables deterministic #143

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aokiji
Copy link

@aokiji aokiji commented Apr 6, 2024

if not some test may fail as the order of the result items can change in accordance to the order that the items in the map are iterated

you can reproduce eventually the problem with:

❯ while test $? == 0 ; do go test github.com/sqls-server/sqls/parser/parseutil -count=1 -run TestExtractTable/select_table_references; done
ok      github.com/sqls-server/sqls/parser/parseutil    0.006s
ok      github.com/sqls-server/sqls/parser/parseutil    0.006s
ok      github.com/sqls-server/sqls/parser/parseutil    0.006s
ok      github.com/sqls-server/sqls/parser/parseutil    0.006s
ok      github.com/sqls-server/sqls/parser/parseutil    0.006s
ok      github.com/sqls-server/sqls/parser/parseutil    0.006s
ok      github.com/sqls-server/sqls/parser/parseutil    0.003s
ok      github.com/sqls-server/sqls/parser/parseutil    0.006s
ok      github.com/sqls-server/sqls/parser/parseutil    0.006s
ok      github.com/sqls-server/sqls/parser/parseutil    0.006s
ok      github.com/sqls-server/sqls/parser/parseutil    0.006s
ok      github.com/sqls-server/sqls/parser/parseutil    0.004s
ok      github.com/sqls-server/sqls/parser/parseutil    0.005s
ok      github.com/sqls-server/sqls/parser/parseutil    0.006s
ok      github.com/sqls-server/sqls/parser/parseutil    0.006s
ok      github.com/sqls-server/sqls/parser/parseutil    0.005s
ok      github.com/sqls-server/sqls/parser/parseutil    0.006s
ok      github.com/sqls-server/sqls/parser/parseutil    0.005s
ok      github.com/sqls-server/sqls/parser/parseutil    0.005s
ok      github.com/sqls-server/sqls/parser/parseutil    0.005s
ok      github.com/sqls-server/sqls/parser/parseutil    0.006s
ok      github.com/sqls-server/sqls/parser/parseutil    0.006s
ok      github.com/sqls-server/sqls/parser/parseutil    0.006s
ok      github.com/sqls-server/sqls/parser/parseutil    0.004s
ok      github.com/sqls-server/sqls/parser/parseutil    0.006s
ok      github.com/sqls-server/sqls/parser/parseutil    0.003s
ok      github.com/sqls-server/sqls/parser/parseutil    0.006s
ok      github.com/sqls-server/sqls/parser/parseutil    0.006s
ok      github.com/sqls-server/sqls/parser/parseutil    0.006s
ok      github.com/sqls-server/sqls/parser/parseutil    0.006s
--- FAIL: TestExtractTable (0.00s)
    --- FAIL: TestExtractTable/select_table_references (0.00s)
        parseutil_test.go:810: unmatched value:   []*parseutil.TableInfo{
                &{
                        DatabaseSchema:  "",
            -           Name:            "abc",
            +           Name:            "def",
                        Alias:           "",
                        SubQueryColumns: nil,
                },
                &{
                        DatabaseSchema:  "",
            -           Name:            "def",
            +           Name:            "abc",
                        Alias:           "",
                        SubQueryColumns: nil,
                },
              }
FAIL
FAIL    github.com/sqls-server/sqls/parser/parseutil    0.005s
FAIL

if not some test may fail as the order of the result items can change in
accordance to the order that the items in the map are iterated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant