|
| 1 | +package datadog.trace.api.datastreams |
| 2 | + |
| 3 | +import spock.lang.Specification |
| 4 | + |
| 5 | + |
| 6 | +class DataStreamsTagsTest extends Specification { |
| 7 | + def getTags(int idx) { |
| 8 | + return new DataStreamsTags("bus" + idx, DataStreamsTags.Direction.Outbound, "exchange" + idx, "topic" + idx, "type" + idx, "subscription" + idx, |
| 9 | + "dataset_name" + idx, "dataset_namespace" + idx, true, "group" + idx, "consumer_group" + idx, true, |
| 10 | + "kafka_cluster_id" + idx, "partition" + idx) |
| 11 | + } |
| 12 | + |
| 13 | + def 'test tags are properly set'() { |
| 14 | + setup: |
| 15 | + def tg = getTags(0) |
| 16 | + |
| 17 | + expect: |
| 18 | + tg.getBus() == DataStreamsTags.BUS_TAG + ":bus0" |
| 19 | + tg.getDirection() == DataStreamsTags.DIRECTION_TAG + ":out" |
| 20 | + tg.getExchange() == DataStreamsTags.EXCHANGE_TAG + ":exchange0" |
| 21 | + tg.getTopic() == DataStreamsTags.TOPIC_TAG + ":topic0" |
| 22 | + tg.getType() == DataStreamsTags.TYPE_TAG + ":type0" |
| 23 | + tg.getSubscription() == DataStreamsTags.SUBSCRIPTION_TAG + ":subscription0" |
| 24 | + tg.getDatasetName() == DataStreamsTags.DATASET_NAME_TAG + ":dataset_name0" |
| 25 | + tg.getDatasetNamespace() == DataStreamsTags.DATASET_NAMESPACE_TAG + ":dataset_namespace0" |
| 26 | + tg.getIsManual() == DataStreamsTags.MANUAL_TAG + ":true" |
| 27 | + tg.getGroup() == DataStreamsTags.GROUP_TAG + ":group0" |
| 28 | + tg.getConsumerGroup() == DataStreamsTags.CONSUMER_GROUP_TAG + ":consumer_group0" |
| 29 | + tg.getHasRoutingKey() == DataStreamsTags.HAS_ROUTING_KEY_TAG + ":true" |
| 30 | + tg.getKafkaClusterId() == DataStreamsTags.KAFKA_CLUSTER_ID_TAG + ":kafka_cluster_id0" |
| 31 | + tg.getPartition() == DataStreamsTags.PARTITION_TAG + ":partition0" |
| 32 | + } |
| 33 | +} |
0 commit comments