Skip to content

mw/com: Update existing method integration tests#479

Draft
bemerybmw wants to merge 11 commits into
mainfrom
brem_methods_sctfs_update_existing
Draft

mw/com: Update existing method integration tests#479
bemerybmw wants to merge 11 commits into
mainfrom
brem_methods_sctfs_update_existing

Conversation

@bemerybmw
Copy link
Copy Markdown
Contributor

Depends-on: #478

bemerybmw added 2 commits May 27, 2026 18:14
We prefer to have copies of the configuration checked in for each test
rather than using a tool to generate them. This makes it easier to
validate that the configuration files are as expected, makes it easier
for a user to use the config file as an example for how to create one
themselves and also prevents the test being altered without realising if
the generation tool is ever updated.
if (!call_result.has_value())
{
FailTest(failure_message_prefix, " Consumer: with_in_args_and_return call failed: ", call_result.error());
return;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

remove return

};

bool CreateProxy(InstanceSpecifier instance_specifier);
void CreateProxy(InstanceSpecifier instance_specifier, const std::string& failure_message_prefix);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

move to commit adding failtest to proxy / skeleton container

std::cerr << "Consumer: Could not allocate method args: " << allocated_args_result.error() << std::endl;
FailTest(
failure_message_prefix, " Consumer: Could not allocate method args: ", allocated_args_result.error());
return Unexpected(allocated_args_result.error());
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

remove


// Set an exit function to notify the provider in case of failure in calls to FailTest, so that it does not wait
// indefinitely for the consumer to finish.
ExitFunction process_synchronizer_guard{[&process_synchronizer_result]() {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

auto process_synchronizer_guard{ExitFunctionGuard::Create(&process_synchronizer_result {
process_synchronizer_result->Notify();
})};

ClearTestExitFunction() should be private and only called by the guard on destruction.

bemerybmw added 9 commits May 28, 2026 13:10
Sometimes we want to perform some clean up before aborting via FailTest.
Since destructors won't be called when calling std::_Exit, we allow
registering a callable which will be called before exiting.

This callable can be registered by creating an ExitFunctionGuard which
will call the registered callable on destruction of the guard or when
exiting via FailTest.
MakeError takes a string_view which was previously binding to a local
string. When the error was logged, the string was already destroyed. We
no longer pass a dynamic string to MakeError to avoid lifetime issues.
This function can be used if we need to store a ProcessSynchronizer in a
data structure which requires it to be moveable (such as a std::vector)
This directory contains a datatype interface containing all 4
combinations of InArgs and Return values. It also provides helper
classes which encapsulate some of the boilerplate code when using this
datatype such as registering method handlers, calling methods etc.
Report failures using FailTest instead of propagating the errors up
through function return types which makes signatures and calling more
complex and can result in tests not failing when they should if the
error code is not handled correctly by the parent layer.
- Don't use MethodConsumer. Since this is a basic test which we want to
  serve also as an example for users, we don't want to extract methods
  related functionality out of the class. Additionally, to simplify the
  code and to make it clearer when MethodConsumer can be used, it's no
  longer templated with the Proxy type so cannot be used with the type
  defined within this test.
- Fail the test using FailTest instead of propagating the errors up
  through function return types which makes signatures and calling more
  complex and can result in tests not failing when they should if the
  error code is not handled correctly by the parent layer.
Fail the test using FailTest instead of propagating the errors up
through function return types which makes signatures and calling more
complex and can result in tests not failing when they should if the
error code is not handled correctly by the parent layer.
@bemerybmw bemerybmw changed the title Brem methods sctfs update existing mw/com: Update existing method integration tests May 28, 2026
@bemerybmw bemerybmw force-pushed the brem_methods_sctfs_update_existing branch from fec6d40 to 4a1dc11 Compare May 28, 2026 11:58
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.

1 participant