Skip to content

test(uncertainty): add integration test for the trait → MA → samples chain#4023

Draft
omkarrr2533 wants to merge 6 commits into
PecanProject:developfrom
omkarrr2533:gsoc/phase1-integration-tests
Draft

test(uncertainty): add integration test for the trait → MA → samples chain#4023
omkarrr2533 wants to merge 6 commits into
PecanProject:developfrom
omkarrr2533:gsoc/phase1-integration-tests

Conversation

@omkarrr2533
Copy link
Copy Markdown
Member

Adds an integration test that runs the modular chain end to end (get_trait_data_pft → meta_analysis_standalone → get_parameter_samples) and checks that each step's output feeds the next with the right shape. It doesn't look at whether the numbers are right, just that the objects flow through without errors. The scientific checks stay in the unit tests, as discussed on Slack.

The test is a plain Rscript at modules/uncertainty/inst/integrationTests/test.modular.chain.R, following the same pattern as the data.atmosphere integration tests, and runs from integration-test.yml on the existing weekly cron. The workflow now stands up a BETY in the container the same way test.yml does, since the first step is a live get_trait_data_pft query.

A few notes:

  • No stopifnot. A failing test_that already halts the script under Rscript, so the job exits non-zero on its own.
  • Using SLA for temperate.deciduous, since the meta-analysis rejects leaf_respiration_rate_m2 against its prior in the CI bety. SLA is one it can actually process, which is all the plumbing test needs.
  • Ran it locally end to end against pecan/db:ci + JAGS. Exit 0, all three steps pass.

Depends on #3978 (get_trait_data_pft), so it's branched off that and opened as a draft. The cron and manual runs can only pass once #3978 is merged and base:develop rebuilds. I'll rebase onto develop once that lands, which also clears #3978's files out of this diff.

query_pfts(strict = TRUE) only catches missing PFTs via setequal(),
not multi-row results (duplicates are equal under set semantics).
Drop strict and do both nrow == 0L and nrow > 1L checks explicitly,
matching the wrapper's canonical error wording so existing test
patterns continue to match.

Addresses review feedback on PecanProject#4010.
@omkarrr2533
Copy link
Copy Markdown
Member Author

Heads up on the diff size this is branched off #3978, so it's showing #3978's commits stacked on develop. The only Week 4 change is the last commit (test(uncertainty): ...): the integration test plus the one step in integration-test.yml, two files. Once #3978 merges I'll rebase onto develop and the diff drops to just those two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant