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

Add an example test for the geometries.lua file #1131

Closed
wants to merge 2 commits into from

Conversation

pnorman
Copy link
Collaborator

@pnorman pnorman commented Apr 18, 2020

Although not complete, this tests the helper functions. Tests for the calls into osm2pgsql still need to be added.

I'm not sure at this point on how to test osm2pgsql.process_node or the osm2pgsql.define_node_table type calls.

@joto
Copy link
Collaborator

joto commented Apr 19, 2020

Thanks for tackling the testing issue. I haven't moved on this a lot because I am not sure yet how to best test the Lua configs. As you have seen yourself, mocking out the osm2pgsql object isn't easy and it is unclear how far this helps us. I think we'll probably have to test actual runs of osm2pgsql with specially grafted data files. But the problem then is checking that the right data ends up in the right places in the database which is rather cumbersome with the current setup.

I am not sure it makes much sense to test geometries.lua. The files in flex-config are intended as part of the documentation, not actual configs people should use. They are simplistic on purpose. We should probably run them in the course of some regression tests to make sure they do not fail completely. But testing every tiny aspect of them isn't really necessary in my opinion.

@pnorman
Copy link
Collaborator Author

pnorman commented Apr 19, 2020

Brief thoughts before bed:

Thanks for tackling the testing issue. I haven't moved on this a lot because I am not sure yet how to best test the Lua configs. As you have seen yourself, mocking out the osm2pgsql object isn't easy and it is unclear how far this helps us. I think we'll probably have to test actual runs of osm2pgsql with specially grafted data files. But the problem then is checking that the right data ends up in the right places in the database which is rather cumbersome with the current setup.

Maybe we can look at test practices from games which use Lua? There's a few games out there that allow complicated expansions of functionality with Lua and supply objects and functions with complicated interactions.

I am not sure it makes much sense to test geometries.lua. The files in flex-config are intended as part of the documentation, not actual configs people should use. They are simplistic on purpose. We should probably run them in the course of some regression tests to make sure they do not fail completely. But testing every tiny aspect of them isn't really necessary in my opinion.

I think they're worth having tests for for two reasons. The first is that we should be showing how to test alongside how to do. We could skip everything but the C transform replacement for this. The second reason, and why I want to test this file is I want to start with simpler tests.

I want to start by figuring out how to test geometries.lua and the other example config files before tackling default-config.lua and compatible.lua.

Although not complete, this tests the helper functions. Tests
for the calls into osm2pgsql still need to be added.
@pnorman pnorman marked this pull request as draft April 22, 2020 05:25
@pnorman
Copy link
Collaborator Author

pnorman commented Apr 22, 2020

It looks like busted might do the mocking I need

This hopefully will serve as a template to show how to test the
callbacks.
@pnorman
Copy link
Collaborator Author

pnorman commented Oct 28, 2020

I have no bandwidth to follow up on this, so closing.

@pnorman pnorman closed this Oct 28, 2020
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.

None yet

2 participants