diff --git a/src/app/tests/suites/TestDiscovery.yaml b/src/app/tests/suites/TestDiscovery.yaml index cac57065f4b5ff..4ed70a70b869c1 100644 --- a/src/app/tests/suites/TestDiscovery.yaml +++ b/src/app/tests/suites/TestDiscovery.yaml @@ -19,7 +19,7 @@ config: endpoint: 0 discriminator: type: INT16U - defaultValue: GetUniqueDiscriminator() + defaultValue: 3840 vendorId: type: INT16U defaultValue: 65521 diff --git a/src/app/tests/suites/commands/discovery/DiscoveryCommands.cpp b/src/app/tests/suites/commands/discovery/DiscoveryCommands.cpp index 5afa23e2d9c87c..5aefcb8112a9b9 100644 --- a/src/app/tests/suites/commands/discovery/DiscoveryCommands.cpp +++ b/src/app/tests/suites/commands/discovery/DiscoveryCommands.cpp @@ -20,7 +20,6 @@ #include #include -#include CHIP_ERROR DiscoveryCommands::FindCommissionable() { @@ -114,36 +113,12 @@ CHIP_ERROR DiscoveryCommands::TearDownDiscoveryCommands() return CHIP_NO_ERROR; } -uint16_t DiscoveryCommands::GetUniqueDiscriminator() -{ - if (mDiscriminatorUseForFiltering == 0) - { - std::random_device dev; - std::mt19937 rng(dev()); - std::uniform_int_distribution distribution(1, 4096); - mDiscriminatorUseForFiltering = static_cast(distribution(rng)); - } - return mDiscriminatorUseForFiltering; -} - void DiscoveryCommands::OnNodeDiscovered(const chip::Dnssd::DiscoveredNodeData & nodeData) { // TODO: If multiple results are found for the same filter, then the test result depends // on which result comes first. At the moment, the code assume that there is only // a single match on the network, but if that's not enough, there may be a need // to implement some sort of list that is built for a given duration before returning - // - // But also, running on CI seems to show cross-talks between CI instances, so multiple - // results will comes up. Unexpected advertisements are filtered by validating the - // discriminator from the advertisement matches the one coming from the config section - // of the test. - if (nodeData.longDiscriminator != GetUniqueDiscriminator()) - { - ChipLogError(chipTool, "Non fatal error: Unexpected node advertisment. It will be ignored"); - nodeData.LogDetail(); - return; - } - ReturnOnFailure(TearDownDiscoveryCommands()); nodeData.LogDetail(); diff --git a/src/app/tests/suites/commands/discovery/DiscoveryCommands.h b/src/app/tests/suites/commands/discovery/DiscoveryCommands.h index d5cfebd9cd4821..848bcaef2c8806 100644 --- a/src/app/tests/suites/commands/discovery/DiscoveryCommands.h +++ b/src/app/tests/suites/commands/discovery/DiscoveryCommands.h @@ -69,12 +69,7 @@ class DiscoveryCommands : public chip::Dnssd::CommissioningResolveDelegate /////////// CommissioningDelegate Interface ///////// void OnNodeDiscovered(const chip::Dnssd::DiscoveredNodeData & nodeData) override; -protected: - // This function initialize a random discriminator once and returns it all the time afterwards - uint16_t GetUniqueDiscriminator(); - private: bool mReady = false; chip::Dnssd::ResolverProxy mDNSResolver; - uint16_t mDiscriminatorUseForFiltering = 0; };