Implement integration tests for fields with set and notifier#463
Implement integration tests for fields with set and notifier#463sahithi-nukala wants to merge 5 commits into
Conversation
8306eb3 to
38982b6
Compare
|
|
||
| // Note : at the moment the SkeletonField::Get implementation is not in the branch which means the skeleton and | ||
| // proxy side does not have same template parameters. | ||
| template <typename SampleType, bool EnableSet = false, bool EnableGet = false, bool EnableNotifier = false> |
There was a problem hiding this comment.
Why did you reorder these?
There was a problem hiding this comment.
Please put this change in a separate commit with a good description of why you're changing traits / traits_test.
There was a problem hiding this comment.
done. updated the traits file changes into a separate commit
| public: | ||
| using InterfaceTrait::Base::Base; | ||
|
|
||
| static constexpr bool kEnableSet{std::is_same_v<InterfaceTrait, SkeletonTrait>}; |
There was a problem hiding this comment.
because this uses same templated interface for both proxy and skeleton, but the field should not have the same capabilities on both sides. so for this set needs to stay enabled on the skeleton side, while the proxy side should remain without set.
| load("@score_baselibs//score/language/safecpp:toolchain_features.bzl", "COMPILER_WARNING_FEATURES") | ||
| load("//quality/unit_testing:unit_testing.bzl", "cc_unit_test") | ||
|
|
||
| cc_library( |
There was a problem hiding this comment.
Moving these should be a separate commit. You can read my comment here to better understand how commits should look / why we split them up: #385 (comment)
There was a problem hiding this comment.
done. pushed these changes with separate commit.
7bd4c90 to
a4435a5
Compare
0e981e5 to
5496cf0
Compare
5496cf0 to
4039570
Compare
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
|
|
||
| test_suite( |
There was a problem hiding this comment.
We decided not to use these component_test suites but we will instead run tests using wildcards e.g. bazel test //score/mw/com/test/.... So you can remove this.
There was a problem hiding this comment.
We usually consumer / provider instead of client / service. Could you please follow the same naming convention?
There was a problem hiding this comment.
Please use the tests in this pr as a guide for new integration tests: #485
| using Parameters = score::mw::com::test::SctfTestRunner::RunParameters::Parameters; | ||
|
|
||
| const std::vector<Parameters> allowed_parameters{Parameters::CYCLE_TIME, Parameters::MODE}; | ||
| score::mw::com::test::SctfTestRunner test_runner(argc, argv, allowed_parameters); |
There was a problem hiding this comment.
SctfTestRunner is very old and we don't use it for new tests. Please look at how we do config parsing here: https://github.com/eclipse-score/communication/blob/brem_methods_sctfs/score/mw/com/test/methods/multiple_proxies/main_provider.cpp
|
|
||
| const std::vector<Parameters> allowed_parameters{Parameters::CYCLE_TIME, Parameters::MODE}; | ||
| score::mw::com::test::SctfTestRunner test_runner(argc, argv, allowed_parameters); | ||
| const auto& run_parameters = test_runner.GetRunParameters(); |
There was a problem hiding this comment.
Need to register a sig term handler like in https://github.com/eclipse-score/communication/blob/brem_methods_sctfs/score/mw/com/test/methods/multiple_proxies/main_provider.cpp
| return -17; | ||
| } | ||
|
|
||
| while (!stop_token.stop_requested()) |
There was a problem hiding this comment.
Use ProcessSynchronizer instead of a loop on the stop token like in
| } | ||
| auto instance_specifier = std::move(instance_specifier_result).value(); | ||
|
|
||
| auto service_result = SetEnabledSkeleton::Create(std::move(instance_specifier)); |
There was a problem hiding this comment.
Use SkeletonContainer instead of doing this yourself
|
|
||
| while (!stop_token.stop_requested()) | ||
| { | ||
| std::this_thread::sleep_for(cycle_time); |
There was a problem hiding this comment.
We don't need cycle_time to be passed in from python, we only want to pass in params that need to be changed when calling the binary from python (e.g. mode). Anyway, this won't be needed when using ProcessSynchronizer.
| if (!instance_specifier_result.has_value()) | ||
| { | ||
| std::cerr << "Unable to create instance specifier, terminating\n"; | ||
| return -3; |
There was a problem hiding this comment.
Instead of returning error codes and propagating this up through all the layers, we should instead use FailTest to immediately fail the test e.g.
There was a problem hiding this comment.
Same applies for the consumer
| auto instance_specifier = std::move(instance_specifier_result).value(); | ||
|
|
||
| std::promise<std::vector<InitialOnlyProxy::HandleType>> service_discovery_promise{}; | ||
| auto service_discovery_future = service_discovery_promise.get_future(); |
| }; | ||
|
|
||
| template <typename T> | ||
| class SetEnabledInterface : public T::Base |
There was a problem hiding this comment.
We should have one class per file.
| namespace score::mw::com::test | ||
| { | ||
|
|
||
| constexpr const char* const kInstanceSpecifierString = "test/fields/set_and_notifier"; |
There was a problem hiding this comment.
The shared constants should be in a different file, not with the interface classes.
| return target.wrap_exec("bin/main_service", args, cwd="/opt/MainServiceApp", **kwargs) | ||
|
|
||
|
|
||
| def test_field_notifier_initial_value(target): |
There was a problem hiding this comment.
We should have different python files per test configuration (e.g. https://github.com/eclipse-score/communication/tree/f6a14ef6f69482b404ec9392067fdd67c5126d51/score/mw/com/test/methods/mixed_criticality/integration_test). The configurations needed are mentioned in the ticket.
Uh oh!
There was an error while loading. Please reload this page.