Commit Graph
93 Commits
Author SHA1 Message Date
John Chilton 44f7317fa5 Allow tools to output collections with static or determinable structure.
By "static" I mean tools such as a FASTQ de-interlacer that would produce a "paired" collection with two datasets everytime. By "determinable" I mean tools that perform N->N operations within the same job - such as a tool that needs to normalize a bunch of datasets all at once and not in separate jobs. (For N->N collection operations that should or can be done in N separate jobs tool authors should just write tools that operate over a dataset and produce a dataset and let the end-user 'map over' that operation.)

There are still large classes of operations where the structure of the output collection cannot be pre-determined - such as splitting files (e.g. bam files by read group) - that are not implemented in this commit.

Model:

The models have been updated to do a more thorough job of tracking collection outputs. Jobs just producing HistoryDatasetCollectionAssociations works fine for simple jobs producing collections - but you don't want to map a list over a tool that produces a pair and produce a bunch of pairs HDCAs and a list:pair HDCA- you just want a bunch of pieces and the one list:pair at that the top.

Workflow:

Workflows containing such operations can be executed - but the workflow editor has not been updated to handle this complexity (and it will require a significant overhaul) so such tools are not available in the workflow editor.

Tool Testing:

This commit also introduces a new tool XML syntax for describing tests on output collections. See files test/functional/tools/collection_creates_list.xml and test/functional/tools/collection_creates_pair.xml for examples.

Tests:

Includes two tools to test this - one that uses explicit pair output names and one that iterates over the structure of input list to produce an output list.

Includes several new tools API tests that test the tools described above via the API and implicit mapping over such tools. Includes two new workflow API tests - one that verifies a simple workflow with output collections works and one that verifies mapping over workflow steps in collections works.
2015-01-15 09:30:00 -05:00
John Chilton 8e060c77bc Implement expect_failure and expect_exit_code on test tag of tools. 2014-12-17 14:22:08 -05:00
John Chilton 77ee2ace67 Allow tool tests to assert properties about command, standard output, and standard error.
See test/functional/tools/job_properties.xml for example. Provides full access to assertion based XML tags - tabular and XML based assertions probably not so interesting so these include - has_text, has_line, not_has_text, has_text_matching, has_line_matching.
2014-12-17 12:34:39 -05:00
John Chilton 887bc44a41 Implement structured tool test data.
Rather than relying solely on exceptions back to nose/test framework - add option (--structured_data_report_file) to run_tests.sh that causes a bunch of detailed data to be dumped to the specified file in a very structured way. Includes full to_dict of the job from the API which in turn includes job metrics, command-line, job's standard error and outputs (instead of the test frameworks), as well as the tool inputs, and exceptions broken out for tool execution versus output checking.

Its all indexed in the file by the test id (without the actual test toolbox depending on knowing the test id) - so one could pair this information with the XUnit output to produce much more detailed breakdowns of the tests.
2014-12-08 00:21:47 -05:00
John Chilton 8479f6b6cc Include diffs for all errors when testing - don't stop at first.
Gives more details to aid testing (especially for tools with lots of outputs) and lets developer collect all correct test data files at once (when GALAXY_TEST_SAVE is set or using `planemo test` with --job_output_files argument) instead of needing to rerun the tool repeatedly.
2014-12-05 23:35:44 -05:00
John Chilton 5682b8bc3d Mark test_toolbox:build_tests as "not a test".
This will prevent run_tests.sh from picking up the extra test when running full test tool box - the way planemo does (i.e. this fixes the problem where planemo always runs one extra passing test).
2014-12-05 23:30:52 -05:00
Dave Bouvier bb3c895e51 Add optional display of stdout/stderr to the jobs API return value, defaulting to not displayed. Rework the test API interactor to wait for jobs instead of histories and get the stdout and stderr from the API. 2014-10-23 10:34:17 -04:00
John Chilton c1ee4c9b31 Add functional test tool demonstrating output filters.
Add new 'expect_num_outputs' attribute to 'test' element in tool XML to verify the produced number - needed to test output filtering.
2014-09-03 08:43:25 -04:00
John Chilton 2782a29fdc Allow tools to test runtime discovered datasets. 2014-03-29 17:11:17 -05:00
Dave Bouvier d1114a1b0f Fix deletion of test methods after tests have been run. 2014-01-16 11:30:25 -05:00
Daniel Blankenberg 1327cc5445 Rename functions to prevent encapsulation / name mangling in test_toolbox.py and test_data_managers.py 2013-12-11 09:00:01 -05:00
Daniel Blankenberg 3db7688a56 Add Functional Testing support for locally and ToolShed installed Data Managers. 2013-12-10 12:59:29 -05:00
John Chilton 9dc1c1d3bc Fix for using API driver with tool outputs that change their name.
E.g. composite data types. API should probably return the original output name since that is the purpose of the parameter but I am not sure how much work that would be.
2013-11-21 19:17:13 -06:00
John Chilton 79458d0d0b Further refactoring for iteractors for reuse. 2013-11-21 19:17:13 -06:00
John Chilton edc88f8aaf Refactor interactors out of test_toolbox into base.
For potential reuse in other tests.
2013-11-21 19:17:13 -06:00
John Chilton 1a6fbc5456 Allow robust disambiguation of repeat statements in tool tests.
Imagine a tool with a repeat statement like:

  <repeat name="rinst" title="Repeat Parameter">
    <param name="int_param" type="integer" value="1" />
    <param name="float_param" type="float" value="2.0" />
  </repeat>

3 test instances overidding int_param default in all three, but leaving the float_param default in place for the first and last can specified as follows:

  <param name="rinst_0|int_param" value="4" />
  <param name="rinst_1|int_param" value="5" />
  <param name="rtnst_2|int_param" value="6" />
  <param name="rinst_1|float_param" value="4.0" />

This syntax can be mixed and matched with specifing conditionals and nested repeats, etc....

One could imagine an alternative syntax like:

  <param name="rinst|int_param" value="4" />
  <param name="rinst|int_param" value="5" />
  <param name="rtnst|int_param" value="6" />
  <param name="rinst|float_param" value="4.0" />

Upon consideration, I have determined that this ambigious syntax is more difficult to reason about, leaves so much ambigiouity in place especially in the context of default and nested elements, and is harder to support. So the plan is to not support it at this time.

The following changeset will add "the right" way to do this anyway:

  <repeat name="rinst">
    <param name="rinst|int_param" value="4" />
  </repeat>
  <repeat name="rinst">
    <param name="rinst|int_param" value="5" />
    <param name="rinst|float_param" value="4.0" />
  </repeat>
  <repeat name="rinst">
    <param name="rinst|int_param" value="6" />
  </repeat>
2013-11-21 19:17:13 -06:00
John Chilton a5153ff420 Make disambiguate_cond more difficult. 2013-11-21 19:17:13 -06:00
John Chilton 425c912e41 Utilize tool test runtime tree analysis earlier to more correctly determine which inputs are data params.
Turns out previous changesets attempting to separately disambiguate and supply implicit defaults for conditionals do not really work with data inputs - because they are not recognized as dataset input params during parsing. Additionally, this change should eliminate any ordering requirements of tool test params - i.e. you shouldn't need to provide the test parameters in an order that makes it clear what branch you are on before suppling a dataset in order for the parser to realize it is a dataset.

Finally, this changeset allows deletion of a lot of code and creates some more robust abstractions.
2013-11-21 19:17:13 -06:00
John Chilton 8c54c91ab9 Allow outputs in tool functional tests to be specified in any order when using API interactor.
Outputs must specify name and must be specified in the same order with the Twill variant. This second restriction is entirely arbitrary using API so dropping it here.

Adding tool demonstrating this functionality (test/functional/tools/output_order.xml) which fails with twill interactor but works fine with API interactor.
2013-11-21 19:17:13 -06:00
John Chilton 1c40b4f359 Extend tool functional test framework to allow testing output dataset metadata.
Adding file test/functional/tools/metadata.xml demonstrating how to check output metadata - this file also demonstrates setting metadata on uploaded datasets and verifies both of these functionalities. Checking output metadata is only available for new API driven tool testing.
2013-11-21 19:17:13 -06:00
John Chilton a7d7800383 Twill-less tool tests - handle input metadata tags. 2013-11-21 19:17:12 -06:00
John Chilton d21e8ceed2 Provide fallback implementation of requests functionality if lib unavailable.
Just limited post/get functionality needed for tests.
2013-11-21 19:17:12 -06:00
John Chilton 036fd68a44 Twill-less tool tests - handle composite inputs.
Add example tool test for composite data (worked with Twill based test framework prior to this commit, works with API based framework as a result of this commit).
2013-11-21 19:17:12 -06:00
John Chilton 37a401ec2c Twill-less tool tests - allow multiple param instances with same name.
Allows specifing multiple repeat instances.
2013-11-21 19:17:12 -06:00
John Chilton 0ebfbc27fe Twill-less tool tests - enhancements related to errors.
- Report formatted standard error and standard output of tools like Twill interactor.
 - Respect testdef.maxseconds to timeout test cases.
 - Check history item - like Twill interactor do not verify 'error' datasets.
 - Properly raise exceptions with reported API error messages when running tools.
2013-11-21 19:17:12 -06:00
John Chilton c919d6cf4d Twill-less tool tests fix for binary data in results.
Use requests' response.content instead of response.text for reading results.

Fixes the following error 'UnicodeEncodeError: 'ascii' codec can't encode characters in position 1-3: ordinal not in range(128)' when dealing with ASN.1 binary files.
2013-11-21 19:17:12 -06:00
John Chilton 71f4ac76f4 Twill-less tool tests fix for tests with html outputs.
For example gatk_analyze_covariates.
2013-11-21 19:17:12 -06:00
John Chilton 3a4fc1bd0d Twill-less tool tests fix for nested input filenames. 2013-11-21 19:17:12 -06:00
John Chilton 67aaf5679a Twill-less tool tests - handle repeats and conditionals.
Expand 'inputs' tree when building tool inputs for API functional tests.

Code is in there for both flat inputs (the way the UI would submit them), and a nested tree structure. The nested tree structure will not work with the Galaxy API currently - but it is the way the API should work :).
2013-11-21 19:17:12 -06:00
John Chilton 8c52dfeb23 Move test_toolbox's expand_grouping out into tool/test.py.
Will be merged with related tree code already in test.py in a subsequent changeset.
2013-11-21 19:17:12 -06:00
John Chilton 79f645eabc Twill-less tool tests - allow tests with GALAXY_TEST_EXTERNAL...
... if GALAXY_TEST_EXTERNAL is ever fixed.
2013-11-21 19:17:12 -06:00
John Chilton b8fe5241c5 Twill-less tool tests initial implementation.
Implement GalaxyInteractorApi, is working for simple tests.

Lots left to do likely - conditionals, repeats, composite uploads, pages(?).

Introduces dependency on Python requests package - subsequent changeset will provide urllib2 based fallback if requests unavailable.
2013-11-21 19:17:12 -06:00
John Chilton a0bc80ed4c Outline new API based galaxy interactor for functional tests.
Add mechanism to tool test parser code to determine which Galaxy interactor should be used ('twill' or 'api' are current options). This maybe a stop gap to force usage of the API interactor until that becomes the default or may prove in the long term to be essential if there are certain tools that will always require Twill-specific functionality or if new browser-based JavaScript (e.g. w/selenium) are implemented. An interactor value can be specified at the tests level and/or at the level of individual test elements in the tool XML (using the 'interactor' attribute on either element).

The current default interactor is 'twill'. The default interactor app-wide can be overridden with the GALAXY_TEST_DEFAULT_INTERACTOR environment variable.
2013-11-21 19:17:12 -06:00
John Chilton 0e31d6c113 Inject master API key into functional test Galaxy.
Override or set external key with GALAXY_TEST_MASTER_API_KEY.
2013-11-21 19:17:12 -06:00
John Chilton aedd40c2eb Upload a tool test's inputs in parallel.
Probably small optimization in most cases since tests generally have few inputs.
2013-11-21 19:17:12 -06:00
John Chilton f08a3fe3bb Refactor data staging and tool running logic out of test/functional/test_toolbox.py.
In a new twill specific interactor class, idea here is to proceed by implementing a matching API interactor class.
2013-11-21 19:17:12 -06:00
John Chilton 0d19995f1a Refactor test data input setup logic out of TestToolBox into ToolTestBuilder.
Simplifying test_toolbox.py will hopefully make it easier to provide an alternative API driven option.
2013-11-21 19:17:12 -06:00
John Chilton 6a2a575e28 Small simplification to test/functional/test_toolbox.py. 2013-11-21 19:17:12 -06:00
John Chilton f05eacf362 Functional tool test fix.
No tests with a repeat and min=1 were ever going to past.
2013-11-17 02:03:28 -06:00
John Chilton 8cab96aa73 Refactor test_toolbox.py into smaller methods.
Enhanced readability, hopefully will aide in plugging in an alternative API driven backend.
2013-10-30 00:01:15 -05:00
John Chilton 9ef20f5269 PEP-8 fixes and style touch-ups for test/functional/test_toolbox.py. 2013-10-30 00:01:15 -05:00
Greg Von Kuster 816a43c2f9 Enhance the functional test framework to support testing tools contained in installed repositories that were not migrated from the Galaxy distribution. To test these tools, use: sh run_functional_tests.sh --installed 2012-03-29 15:02:36 -04:00
Greg Von Kuster 60c0bdf17b Enhance the functional test framework to support tools migrated from the distribution and installed from the tool shed. To test these tools, use: sh run_functional_tests.sh --migrated 2012-03-29 12:03:14 -04:00
Greg Von Kuster 6dc3ff8eb2 Enhance the process used by objects to retrieve tools from the tools_by_id dictionary. This allows for workflows that were built with tools originally included in the Galaxy distribution but later moved to the tool shed to function correctly if the tools are installed from the tool shed using Galaxy's update manager. In addition, workflows that were built using locally developed and hosted tools, but the tools were included in a tool shed repository, removed from the local instance, and then installed from the tool shed to function correctly. This approach works for the rerun button on history items as well. 2012-01-17 14:31:06 -05:00
Nate Coraor 3c5c6ce091 Fix for some output changes I made to functional tests. 2011-12-08 10:14:29 -05:00
Nate Coraor 44344fe2e0 Fix the dataset controller's stderr method and add one for stdout. Link to
both from the dataset info page.  The functional tests will now provide output
of these on tool test failure.  The functional tests can now use
tool_dependency_dir as well.
2011-12-06 11:29:02 -05:00
Daniel Blankenberg eefc21c030 Allow toolbox tests to test 0 instances of a repeat. 2011-10-20 10:03:28 -04:00
Daniel Blankenberg 7a1f15ab7e Fix for expand grouping to allow toolbox tests to use the default parameter value. 2011-05-10 19:59:46 -04:00
Daniel Blankenberg 4eb1b0a79f Better determination in tests if a provided input is a DataToolParameter to better handle .gz and .zip uploads and allowing uploads from a sub-directory of test-data/. 2011-02-28 12:16:28 -05:00
Daniel Blankenberg 3854d341ad Allow toolbox tests to upload a file found located in subdirectories. Fix a bug occurring on the determination of uploaded dataset name during the handling of the removal of .gzip or .zip extension from the uploaded filenames within the toolbox test framework. 2011-02-22 16:56:11 -05:00