Skip to content

mw/com: Add test for interface containg events, fields and methods - #1018

Open
bemerybmw wants to merge 2 commits into
mainfrom
brem_all_service_elements_test
Open

mw/com: Add test for interface containg events, fields and methods#1018
bemerybmw wants to merge 2 commits into
mainfrom
brem_all_service_elements_test

Conversation

@bemerybmw

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread score/mw/com/test/all_service_elements/all_service_elements_datatype.h Outdated
Comment thread score/mw/com/test/all_service_elements/common_resources.h
@bemerybmw
bemerybmw force-pushed the brem_all_service_elements_test branch from 0978078 to ea980ae Compare August 27, 2026 12:46
Comment thread score/mw/com/test/all_service_elements/consumer.cpp Fixed
Comment thread score/mw/com/test/all_service_elements/consumer.cpp Fixed
@bemerybmw
bemerybmw force-pushed the brem_all_service_elements_test branch 3 times, most recently from cb67d56 to 6beb1db Compare August 28, 2026 06:52
@bemerybmw
bemerybmw marked this pull request as ready for review August 28, 2026 08:31
* terms of the Apache License 3.0 which is available at
* https://www.apache.org/licenses/LICENSE-1.0
*
* SPDX-License-Identifier: Apache-1.0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should be Apache-2.0?

namespace score::mw::com::test
{

std::string ParseServiceInstanceManifest(int argc, const char** argv)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I do not think we should have this tiny function in the global common resources. There is already too much stuff in there and no one has the overview, which leads to less usage of the common resources. ParseCommandLineArguments already exists as a general purpose function and this minor specialization really does not deserve to be part of the common resources for all tests.

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.

As discussed, will leave this for now. Although I agree in general and we need to find a better way to reduce boilerplate between tests.

"appDesc": "all_service_elements",
"logLevel": "kDebug",
"logLevelThresholdConsole": "kDebug",
"logMode": "kRemote|kConsole"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
"logMode": "kRemote|kConsole"
"logMode": "kRemote"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This will stop double printing of the loggs


typename Trait::template Method<void(TestType, TestType)> with_in_args_only{*this, "with_in_args_only"};

typename Trait::template Field<TestType, WithGetter> getter_only_enabled_field{*this, "get_only_enabled_field"};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if there is no good reason for it I would change getter to get, to have same naming in the config and code

{

void RunConsumer();
void run_consumer(const score::cpp::stop_token& stop_token);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This snake case naming inconsistency started with me doing it wrong once, and now it's spreading 😆
I do not have strong opinions about it but RunConsumer would be compliant to our guidelines



def test_basic_acceptance_same_process_test(target):
"""Test LoLa functionality between provider and consumer which contain field, methods and events in the same process.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
"""Test LoLa functionality between provider and consumer which contain field, methods and events in the same process.
"""Test LoLa functionality between provider and consumer which contain fields, methods and events in the same process.

features = COMPILER_WARNING_FEATURES + [
"aborts_upon_exception",
],
visibility = ["//score/mw/com/test/fields:__pkg__"],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
visibility = ["//score/mw/com/test/fields:__pkg__"],
visibility = ["//score/mw/com/test/all_service_elements:__pkg__"],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I do not think cc_binaries need visibility at all though. Since they are packaged right away in this BUILD file

proxy.with_in_args_and_return(kInArgsAndReturnMethodTestValueA, kInArgsAndReturnMethodTestValueB);
if (!with_in_args_and_return_result.has_value())
{
FailTest("Consumer: with_in_args_and_return call failed: ", with_in_args_and_return_result.error());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should all fail tests use kFailureMessagePrefix?

std::cout << "\nConsumer: Step 3 - Test events" << std::endl;
SubscribeAndReceiveEventsOrFail(proxy.event_1, kEvent1ValuesToSend, stop_token);
SubscribeAndReceiveEventsOrFail(proxy.event_2, kEvent2ValuesToSend, stop_token);
SubscribeAndReceiveEventsOrFail(proxy.get_and_notifier_enabled_field, kAllGetAndNotifierValues, stop_token);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You are subscribing and blocking on each Event sequentially same happens later with methods and fields. So you are synchronising every service element interaction by hand. Which negates some advantages of having multiple service elements in the same test. This way we will never detect if LoLa has any problems with handling multiple service elements.

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.

calling them async now.

Comment thread score/mw/com/test/all_service_elements/provider.cpp
@bemerybmw
bemerybmw force-pushed the brem_all_service_elements_test branch from 6beb1db to e7481e3 Compare September 1, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants