Skip to content

Make AggregateActionxData More Amenable to Unit Testing#5239

Draft
bska wants to merge 3 commits into
OPM:masterfrom
bska:unit-test-aggregate-actionx
Draft

Make AggregateActionxData More Amenable to Unit Testing#5239
bska wants to merge 3 commits into
OPM:masterfrom
bska:unit-test-aggregate-actionx

Conversation

@bska

@bska bska commented Jul 2, 2026

Copy link
Copy Markdown
Member

This PR revises the set of AggregateActionxData constructors to take simpler types. Previously, we needed a full Schedule object in order to form instances of AggregateActionxData and constructing Schedule objects, at least those that are viable for Actionx restart file unit testing, is very hard to do without parsing a mostly complete input file. This, in turn, made unit testing the class harder than necessary.

The new canonical constructor takes the actual ActionX objects as a std::span<> and derives object and line counts from those. We still need a UnitSystem, well names, and start/elapsed times, but we now pass those through a new, dedicated "context" object instead of getting the values from a Schedule object.

We also create two free function overloads to simplify transition to the new constructor, but expect that those will be removed in due time. For now though, they're used in the existing unit test for class AggregateActionxData.

@bska bska added the manual:irrelevant This PR is a minor fix and should not appear in the manual label Jul 2, 2026
@bska

bska commented Jul 2, 2026

Copy link
Copy Markdown
Member Author

I'm creating this PR in draft mode because it depends on, and contains, the earlier PR #5238. I will keep the PR in a draft state until such time as it is ready for review.

This commit revises the set of AggregateActionxData constructors to
take simpler types.  Previously, we needed a full Schedule object in
order to form instances of AggregateActionxData and constructing
Schedule objects, at least those that are viable for Actionx restart
file unit testing, is very hard to do without parsing a mostly
complete input file.  This, in turn, made unit testing the class
harder than necessary.

The new canonical constructor takes the actual ActionX objects as a
std::span<> and derives object and line counts from those.  We still
need a UnitSystem, well names, and start/elapsed times, but we now
pass those through a new, dedicated "context" object instead of
getting the values from a Schedule object.

We also create two free function overloads to simplify transition to
the new constructor, but expect that those will be removed in due
time.  For now though, they're used in the existing unit test for
class AggregateActionxData.
@bska bska force-pushed the unit-test-aggregate-actionx branch from abfe65b to 113666b Compare July 3, 2026 07:51
@bska bska requested a review from Copilot July 3, 2026 07:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors Opm::RestartIO::Helpers::AggregateActionxData construction to remove the hard dependency on a fully-populated Schedule, making the type easier to instantiate in isolation for unit tests and other callers.

Changes:

  • Introduces a new “canonical” AggregateActionxData constructor that takes std::span<const Action::ActionX> plus a dedicated AggregateActionxRuntimeContext.
  • Adds createAggregateActionxData(...) overloads to adapt existing call sites (notably Schedule-based usage) to the new constructor.
  • Updates restart-writing code and unit tests to use the new factory function and adds a new span-based constructor test.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/test_AggregateActionxData.cpp Adds a new standalone span-based constructor test and migrates existing tests to the factory helper.
opm/output/eclipse/RestartIO.cpp Switches restart output generation to use createAggregateActionxData(...).
opm/output/eclipse/AggregateActionxData.hpp Adds runtime context struct, span-based constructor, deprecated compatibility ctor, and factory function declarations.
opm/output/eclipse/AggregateActionxData.cpp Implements span-based construction path and the new factory function overloads.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread opm/output/eclipse/AggregateActionxData.hpp Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread tests/test_AggregateActionxData.cpp
Comment thread opm/output/eclipse/AggregateActionxData.cpp
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

manual:irrelevant This PR is a minor fix and should not appear in the manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants