def test_tag_match(): event = Event() event.level = EventLevel.INFO event.tags = ["arm", "restore"] event.type = "partition" assert EventTagFilter(["partition+arm"]).match(event) is True assert EventTagFilter(["partition+arm+restore"]).match(event) is True assert EventTagFilter(["partition"]).match(event) is True assert EventTagFilter(["arm"]).match(event) is True assert EventTagFilter(["arm-zone"]).match(event) is True assert EventTagFilter(["arm-partition"]).match(event) is False assert EventTagFilter(["arm-zone+restore+partition"]).match(event) is True assert EventTagFilter(["zone"]).match(event) is False assert EventTagFilter(["zone", "arm"]).match(event) is True assert EventTagFilter(["partition,arm"]).match(event) is True assert EventTagFilter(["partition, arm"]).match(event) is True assert EventTagFilter(["partition, -arm"]).match(event) is False assert EventTagFilter(["live,partition,arm"]).match(event) is False assert EventTagFilter(["change,partition,arm"]).match(event) is False event.level = EventLevel.DEBUG assert EventTagFilter(["partition+arm"]).match(event) is False
def test_tag_match(): event = Event() event.level = EventLevel.INFO event.tags = ['arm', 'restore'] event.type = 'partition' assert EventTagFilter(['partition+arm']).match(event) is True assert EventTagFilter(['partition+arm+restore']).match(event) is True assert EventTagFilter(['partition']).match(event) is True assert EventTagFilter(['arm']).match(event) is True assert EventTagFilter(['arm-zone']).match(event) is True assert EventTagFilter(['arm-partition']).match(event) is False assert EventTagFilter(['arm-zone+restore+partition']).match(event) is True assert EventTagFilter(['zone']).match(event) is False assert EventTagFilter(['zone', 'arm']).match(event) is True assert EventTagFilter(['partition,arm']).match(event) is True assert EventTagFilter(['partition, arm']).match(event) is True assert EventTagFilter(['partition, -arm']).match(event) is False event.level = EventLevel.DEBUG assert EventTagFilter(['partition+arm']).match(event) is False