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

Bad YAML test syntax throws cryptic error in plot_tests #19

Open
colearendt opened this issue May 17, 2018 · 0 comments
Open

Bad YAML test syntax throws cryptic error in plot_tests #19

colearendt opened this issue May 17, 2018 · 0 comments

Comments

@colearendt
Copy link
Contributor

If the YAML syntax is bad, then the test suite will run, but the format is different enough that plot_tests will fail with a cryptic error message that is very challenging to debug.

 Error in data.frame(file = test$file, context = context, test = test$test,  : 
  arguments imply differing number of rows: 1, 2 

The YAML that generated the bad test results (for repro):

- test-tolower:
    mutate: tolower(fld_character)
    group_by: tolower(fld_character)
  test-toupper:
    mutate: toupper(fld_character)
    group_by: toupper(fld_character)

You can generate that YAML file with:

test_file <- fs::path_temp("test-file.yml")
yaml::write_yaml(
  list(
    setNames(
    list(
      list(
        "mutate" = "tolower(fld_character)"
        , "group_by" = "tolower(fld_character)"
      )
      , list(
        "mutate" = "toupper(fld_character)"
        , "group_by" = "toupper(fld_character)"
      )
    )
    , c("test-tolower", "test-toupper")
  ))
  , file = test_file
)

And then that just needs to be executed as follows:

test_results <- dbtest::test_databases("conn.yml", test_file)
dbtest::plot_tests(test_results)

Fix would be a better error message, better recovery from bad YAML tests, or something of the like.

colearendt added a commit to colearendt/dbtest that referenced this issue May 17, 2018
colearendt added a commit to colearendt/dbtest that referenced this issue May 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant