Closed JackDanger closed 8 years ago
The unit tests require a bit more setup than documented. It's also tricky because most people won't be able to test many operators because you may not have some of the systems in your infrastructure. For instance I can't test Microsoft SQL Server of Postgres related hooks and operators because I don't have any of those laying around.
I'll try to generalize the tests and document the setup process as much as possible. In the meantime, you can run the first few lines of rununittests.sh
to point to a unit tests environment, run airflow initdb
and airflow webserver
to get in the UI and provide that connection information for the systems you support (mysql_default, presto_default, hdfs_default, ).
Note that some tests may (at the moment) require data structures that you don't have, notably a "babynames" dataset. One of the tests should probably one that populates said dataset...
Maybe we can work together at making running tests outside of Airbnb as easy as possible.
I also run the tests before I merge any significant PRs to master, and thoroughly before pushing a new release to Pypi. So it's ok to submit a PR without having passed all tests, at least for now.
I'll try to generalize the tests and document the setup process as much as possible.
@mistercrunch I'd be happy to do this work. Luigi runs tests on Travis CI using MySQL, PostgreSQL and Hadoop as dependencies so I'm sure we can get those working here as well.
run
airflow initdb
andairflow webserver
Ah, I see. I'll make a PR that generates the airflow
executable and runs these commands as a preliminary step to running the tests so developers don't need to worry about them.
Maybe we can work together at making running tests outside of Airbnb as easy as possible.
That's my goal! I won't be able to run Airflow at Square (even just to play around) if it doesn't have automated tests with ok coverage that can run and pass.
Sounds awesome. Really glad to have you on board.
You can totally squeeze an airflow initdb
line in here: https://github.com/airbnb/airflow/blob/master/run_unit_tests.sh
I'm planning on doing a coverage blitz, and @artwr is hooking up travis-ci. I've been looking at the travis widget in other Github project thinking I should do whatever is needed to enable this!
I added a section in the CONTRIBUTING.md with loose guideline on how to setup the unit tests https://github.com/airbnb/airflow/blob/master/CONTRIBUTING.md#running-unit-tests
btw @artwr is working on setting up travis!
I cloned the repo, followed the contribution guidelines, and the tests failed. There appears to be an issue with some modules not importable and the
connection
sqlite table isn't created as part of the test setup.I'm reporting this as an issue rather than just asking for help because I don't see Airflow configured in Travis.ci and I'm wondering if the unit tests have been broken for a while now.
I'm not very experienced at Python but if somebody could point me in the right direction I could try to fix this all up.