def test_parse_qos_compatible_expressions(): tests = [([ "Reliability.Reliable 10,", "History.KeepLast: 10", "ResourceLimits 100, -1 100", "PresentationAccessScope.Topic 1 no", "liFespAn seconds=1000;days=12", "deadline seconds=1", "WriterDataLifecycle off" ], [ Policy.Reliability.Reliable(max_blocking_time=10), Policy.History.KeepLast(depth=10), Policy.ResourceLimits(max_samples=100, max_instances=-1, max_samples_per_instance=100), Policy.PresentationAccessScope.Topic(coherent_access=True, ordered_access=False), Policy.Lifespan(lifespan=1037800000000000), Policy.Deadline(deadline=1000000000), Policy.WriterDataLifecycle(autodispose=False) ])] for (input, result) in tests: pubsub, ddsls = run_pubsub_ddsls(["-T", "test", "-q", ' '.join(input)], ["-a"], runtime=2) for policy in result: assert str(policy) in ddsls["stdout"] assert pubsub["status"] == 0
def test_parse_qos(): tests = \ [ ( [ "Reliability.Reliable 10000000", "Durability.TransientLocal", "History.KeepLast 10", "ResourceLimits 100 -1 100", "PresentationAccessScope.Topic True False", "Lifespan 1000000", "Deadline seconds=1", "LatencyBudget 10000000", "Ownership.Exclusive", "OwnershipStrength 20", "Liveliness.ManualByParticipant 100000", "TimeBasedFilter 100000", "Partition Hello, world", "TransportPriority 1", "DestinationOrder.BySourceTimestamp", "WriterDataLifecycle False", "ReaderDataLifecycle 10000000 10000000", "DurabilityService 100000 History.KeepLast 100, 2000, 1000, 1000", "Userdata HiUser", "Groupdata HiGroup", "Topicdata HiTopic" ], Qos( Policy.Reliability.Reliable(max_blocking_time=10000000), Policy.Durability.TransientLocal, Policy.History.KeepLast(depth=10), Policy.ResourceLimits(max_samples=100, max_instances=-1, max_samples_per_instance=100), Policy.PresentationAccessScope.Topic(coherent_access=True, ordered_access=False), Policy.Lifespan(lifespan=1000000), Policy.Deadline(deadline=1000000000), Policy.LatencyBudget(budget=10000000), Policy.Ownership.Exclusive, Policy.OwnershipStrength(strength=20), Policy.Liveliness.ManualByParticipant(lease_duration=100000), Policy.TimeBasedFilter(filter_time=100000), Policy.Partition(partitions=('Hello', 'world')), Policy.TransportPriority(priority=1), Policy.DestinationOrder.BySourceTimestamp, Policy.WriterDataLifecycle(autodispose=False), Policy.ReaderDataLifecycle(autopurge_nowriter_samples_delay=10000000, autopurge_disposed_samples_delay=10000000), Policy.DurabilityService(cleanup_delay=100000, history=Policy.History.KeepLast(depth=100), max_samples=2000, max_instances=1000, max_samples_per_instance=1000), Policy.Userdata(data=b'HiUser'), Policy.Groupdata(data=b'HiGroup'), Policy.Topicdata(data=b'HiTopic'), ) ) ] for (input, result) in tests: pubsub, ddsls = run_pubsub_ddsls(["-T", "test", "-q", ' '.join(input)], ["-a"], runtime=2) for policy in result: assert str(policy) in ddsls["stdout"] assert pubsub["status"] == 0