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 Outdated
@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 2 times, most recently from 5e8f9b6 to cb67d56 Compare August 28, 2026 06:46
@bemerybmw
bemerybmw force-pushed the brem_all_service_elements_test branch 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.

"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.

std::cout << "\nProvider: Step 4 - Set initial field values" << std::endl;
UpdateField(service.getter_only_enabled_field, kGetterOnlyFieldInitialValue);
UpdateField(service.set_and_get_enabled_field, kSetAndGetFieldInitialValue);
UpdateField(service.get_and_notifier_enabled_field, kGetAndNotifierFieldInitialValue);

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 see the same artificial synchronization issue here as with the receiver.

I think the test would be stronger if you would issue the Send/Update calls first and wait on all of them at once later. That way LoLa will have to handle the correct synchronization

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.

resolved offline

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