// Copyright 2020 The Prometheus Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package dockerswarm import ( "context" "fmt" "testing" "github.com/go-kit/kit/log" "github.com/prometheus/common/model" "github.com/prometheus/prometheus/util/testutil" ) func TestDockerSwarmTasksSDRefresh(t *testing.T) { sdmock := NewSDMock(t, "swarmprom") sdmock.Setup() e := sdmock.Endpoint() cfg := DefaultSDConfig cfg.Host = e[:len(e)-1] d, err := NewDiscovery(&cfg, log.NewNopLogger()) testutil.Ok(t, err) ctx := context.Background() tgs, err := d.refreshTasks(ctx) testutil.Ok(t, err) testutil.Equals(t, 1, len(tgs)) tg := tgs[0] testutil.Assert(t, tg != nil, "tg should not be nil") testutil.Assert(t, tg.Targets != nil, "tg.targets should not be nil") testutil.Equals(t, 17, len(tg.Targets)) for i, lbls := range []model.LabelSet{ { "__address__": model.LabelValue("10.0.0.8:9100"), "__meta_dockerswarm_network_id": model.LabelValue("qvwhwd6p61k4o0ulsknqb066z"), "__meta_dockerswarm_network_ingress": model.LabelValue("true"), "__meta_dockerswarm_network_internal": model.LabelValue("false"), "__meta_dockerswarm_network_name": model.LabelValue("ingress"), "__meta_dockerswarm_network_scope": model.LabelValue("swarm"), "__meta_dockerswarm_node_address": model.LabelValue("10.0.232.5"), "__meta_dockerswarm_node_availability": model.LabelValue("active"), "__meta_dockerswarm_node_hostname": model.LabelValue("worker-2"), "__meta_dockerswarm_node_id": model.LabelValue("ldawcom10uqi6owysgi28n4ve"), "__meta_dockerswarm_node_platform_architecture": model.LabelValue("x86_64"), "__meta_dockerswarm_node_platform_os": model.LabelValue("linux"), "__meta_dockerswarm_node_role": model.LabelValue("worker"), "__meta_dockerswarm_node_status": model.LabelValue("ready"), "__meta_dockerswarm_service_id": model.LabelValue("3qvd7bwfptmoht16t1f7jllb6"), "__meta_dockerswarm_service_label_com_docker_stack_image": model.LabelValue("stefanprodan/swarmprom-node-exporter:v0.16.0"), "__meta_dockerswarm_service_label_com_docker_stack_namespace": model.LabelValue("mon"), "__meta_dockerswarm_service_mode": model.LabelValue("global"), "__meta_dockerswarm_service_name": model.LabelValue("mon_node-exporter"), "__meta_dockerswarm_task_container_id": model.LabelValue("a137690f7070c536470aeae2d40cd4ecabe59842e5c2fce0cc7596f7d3d85c59"), "__meta_dockerswarm_task_desired_state": model.LabelValue("running"), "__meta_dockerswarm_task_id": model.LabelValue("40wy6ekgchzz38dqjv07qt79w"), "__meta_dockerswarm_task_port_publish_mode": model.LabelValue("ingress"), "__meta_dockerswarm_task_slot": model.LabelValue("0"), "__meta_dockerswarm_task_state": model.LabelValue("running"), }, { "__address__": model.LabelValue("10.0.1.3:9100"), "__meta_dockerswarm_network_id": model.LabelValue("npq2closzy836m07eaq1425k3"), "__meta_dockerswarm_network_ingress": model.LabelValue("false"), "__meta_dockerswarm_network_internal": model.LabelValue("false"), "__meta_dockerswarm_network_label_com_docker_stack_namespace": model.LabelValue("mon"), "__meta_dockerswarm_network_name": model.LabelValue("mon_net"), "__meta_dockerswarm_network_scope": model.LabelValue("swarm"), "__meta_dockerswarm_node_address": model.LabelValue("10.0.232.5"), "__meta_dockerswarm_node_availability": model.LabelValue("active"), "__meta_dockerswarm_node_hostname": model.LabelValue("worker-2"), "__meta_dockerswarm_node_id": model.LabelValue("ldawcom10uqi6owysgi28n4ve"), "__meta_dockerswarm_node_platform_architecture": model.LabelValue("x86_64"), "__meta_dockerswarm_node_platform_os": model.LabelValue("linux"), "__meta_dockerswarm_node_role": model.LabelValue("worker"), "__meta_dockerswarm_node_status": model.LabelValue("ready"), "__meta_dockerswarm_service_id": model.LabelValue("3qvd7bwfptmoht16t1f7jllb6"), "__meta_dockerswarm_service_label_com_docker_stack_image": model.LabelValue("stefanprodan/swarmprom-node-exporter:v0.16.0"), "__meta_dockerswarm_service_label_com_docker_stack_namespace": model.LabelValue("mon"), "__meta_dockerswarm_service_mode": model.LabelValue("global"), "__meta_dockerswarm_service_name": model.LabelValue("mon_node-exporter"), "__meta_dockerswarm_task_container_id": model.LabelValue("a137690f7070c536470aeae2d40cd4ecabe59842e5c2fce0cc7596f7d3d85c59"), "__meta_dockerswarm_task_desired_state": model.LabelValue("running"), "__meta_dockerswarm_task_id": model.LabelValue("40wy6ekgchzz38dqjv07qt79w"), "__meta_dockerswarm_task_port_publish_mode": model.LabelValue("ingress"), "__meta_dockerswarm_task_slot": model.LabelValue("0"), "__meta_dockerswarm_task_state": model.LabelValue("running"), }, { "__address__": model.LabelValue("10.0.0.12:9100"), "__meta_dockerswarm_network_id": model.LabelValue("qvwhwd6p61k4o0ulsknqb066z"), "__meta_dockerswarm_network_ingress": model.LabelValue("true"), "__meta_dockerswarm_network_internal": model.LabelValue("false"), "__meta_dockerswarm_network_name": model.LabelValue("ingress"), "__meta_dockerswarm_network_scope": model.LabelValue("swarm"), "__meta_dockerswarm_node_address": model.LabelValue("10.0.232.4"), "__meta_dockerswarm_node_availability": model.LabelValue("active"), "__meta_dockerswarm_node_hostname": model.LabelValue("worker-1"), "__meta_dockerswarm_node_id": model.LabelValue("jkc2xd7p3xdazf0u6sh1m9dmr"), "__meta_dockerswarm_node_platform_architecture": model.LabelValue("x86_64"), "__meta_dockerswarm_node_platform_os": model.LabelValue("linux"), "__meta_dockerswarm_node_role": model.LabelValue("worker"), "__meta_dockerswarm_node_status": model.LabelValue("ready"), "__meta_dockerswarm_service_id": model.LabelValue("3qvd7bwfptmoht16t1f7jllb6"), "__meta_dockerswarm_service_label_com_docker_stack_image": model.LabelValue("stefanprodan/swarmprom-node-exporter:v0.16.0"), "__meta_dockerswarm_service_label_com_docker_stack_namespace": model.LabelValue("mon"), "__meta_dockerswarm_service_mode": model.LabelValue("global"), "__meta_dockerswarm_service_name": model.LabelValue("mon_node-exporter"), "__meta_dockerswarm_task_container_id": model.LabelValue("fe665e092d225bb42da4f9af3439f91c8379f37f1928d74d8f8ae8797f456737"), "__meta_dockerswarm_task_desired_state": model.LabelValue("running"), "__meta_dockerswarm_task_id": model.LabelValue("b5sk2vnp3gj9j4kmcklzkmkt0"), "__meta_dockerswarm_task_port_publish_mode": model.LabelValue("ingress"), "__meta_dockerswarm_task_slot": model.LabelValue("0"), "__meta_dockerswarm_task_state": model.LabelValue("running"), }, { "__address__": model.LabelValue("10.0.1.7:9100"), "__meta_dockerswarm_network_id": model.LabelValue("npq2closzy836m07eaq1425k3"), "__meta_dockerswarm_network_ingress": model.LabelValue("false"), "__meta_dockerswarm_network_internal": model.LabelValue("false"), "__meta_dockerswarm_network_label_com_docker_stack_namespace": model.LabelValue("mon"), "__meta_dockerswarm_network_name": model.LabelValue("mon_net"), "__meta_dockerswarm_network_scope": model.LabelValue("swarm"), "__meta_dockerswarm_node_address": model.LabelValue("10.0.232.4"), "__meta_dockerswarm_node_availability": model.LabelValue("active"), "__meta_dockerswarm_node_hostname": model.LabelValue("worker-1"), "__meta_dockerswarm_node_id": model.LabelValue("jkc2xd7p3xdazf0u6sh1m9dmr"), "__meta_dockerswarm_node_platform_architecture": model.LabelValue("x86_64"), "__meta_dockerswarm_node_platform_os": model.LabelValue("linux"), "__meta_dockerswarm_node_role": model.LabelValue("worker"), "__meta_dockerswarm_node_status": model.LabelValue("ready"), "__meta_dockerswarm_service_id": model.LabelValue("3qvd7bwfptmoht16t1f7jllb6"), "__meta_dockerswarm_service_label_com_docker_stack_image": model.LabelValue("stefanprodan/swarmprom-node-exporter:v0.16.0"), "__meta_dockerswarm_service_label_com_docker_stack_namespace": model.LabelValue("mon"), "__meta_dockerswarm_service_mode": model.LabelValue("global"), "__meta_dockerswarm_service_name": model.LabelValue("mon_node-exporter"), "__meta_dockerswarm_task_container_id": model.LabelValue("fe665e092d225bb42da4f9af3439f91c8379f37f1928d74d8f8ae8797f456737"), "__meta_dockerswarm_task_desired_state": model.LabelValue("running"), "__meta_dockerswarm_task_id": model.LabelValue("b5sk2vnp3gj9j4kmcklzkmkt0"), "__meta_dockerswarm_task_port_publish_mode": model.LabelValue("ingress"), "__meta_dockerswarm_task_slot": model.LabelValue("0"), "__meta_dockerswarm_task_state": model.LabelValue("running"), }, { "__address__": model.LabelValue("10.0.0.11:9100"), "__meta_dockerswarm_network_id": model.LabelValue("qvwhwd6p61k4o0ulsknqb066z"), "__meta_dockerswarm_network_ingress": model.LabelValue("true"), "__meta_dockerswarm_network_internal": model.LabelValue("false"), "__meta_dockerswarm_network_name": model.LabelValue("ingress"), "__meta_dockerswarm_network_scope": model.LabelValue("swarm"), "__meta_dockerswarm_node_address": model.LabelValue("10.0.232.3"), "__meta_dockerswarm_node_availability": model.LabelValue("active"), "__meta_dockerswarm_node_hostname": model.LabelValue("master-3"), "__meta_dockerswarm_node_id": model.LabelValue("bvtjl7pnrtg0k88ywialsldpd"), "__meta_dockerswarm_node_platform_architecture": model.LabelValue("x86_64"), "__meta_dockerswarm_node_platform_os": model.LabelValue("linux"), "__meta_dockerswarm_node_role": model.LabelValue("manager"), "__meta_dockerswarm_node_status": model.LabelValue("ready"), "__meta_dockerswarm_service_id": model.LabelValue("3qvd7bwfptmoht16t1f7jllb6"), "__meta_dockerswarm_service_label_com_docker_stack_image": model.LabelValue("stefanprodan/swarmprom-node-exporter:v0.16.0"), "__meta_dockerswarm_service_label_com_docker_stack_namespace": model.LabelValue("mon"), "__meta_dockerswarm_service_mode": model.LabelValue("global"), "__meta_dockerswarm_service_name": model.LabelValue("mon_node-exporter"), "__meta_dockerswarm_task_container_id": model.LabelValue("85fcbc74e09fc86532773a757527fca6af60b81bfb4ef6962098c3ae46e0b0b9"), "__meta_dockerswarm_task_desired_state": model.LabelValue("running"), "__meta_dockerswarm_task_id": model.LabelValue("daxcdhbv3oupklh04l4sxy005"), "__meta_dockerswarm_task_port_publish_mode": model.LabelValue("ingress"), "__meta_dockerswarm_task_slot": model.LabelValue("0"), "__meta_dockerswarm_task_state": model.LabelValue("running"), }, { "__address__": model.LabelValue("10.0.1.6:9100"), "__meta_dockerswarm_network_id": model.LabelValue("npq2closzy836m07eaq1425k3"), "__meta_dockerswarm_network_ingress": model.LabelValue("false"), "__meta_dockerswarm_network_internal": model.LabelValue("false"), "__meta_dockerswarm_network_label_com_docker_stack_namespace": model.LabelValue("mon"), "__meta_dockerswarm_network_name": model.LabelValue("mon_net"), "__meta_dockerswarm_network_scope": model.LabelValue("swarm"), "__meta_dockerswarm_node_address": model.LabelValue("10.0.232.3"), "__meta_dockerswarm_node_availability": model.LabelValue("active"), "__meta_dockerswarm_node_hostname": model.LabelValue("master-3"), "__meta_dockerswarm_node_id": model.LabelValue("bvtjl7pnrtg0k88ywialsldpd"), "__meta_dockerswarm_node_platform_architecture": model.LabelValue("x86_64"), "__meta_dockerswarm_node_platform_os": model.LabelValue("linux"), "__meta_dockerswarm_node_role": model.LabelValue("manager"), "__meta_dockerswarm_node_status": model.LabelValue("ready"), "__meta_dockerswarm_service_id": model.LabelValue("3qvd7bwfptmoht16t1f7jllb6"), "__meta_dockerswarm_service_label_com_docker_stack_image": model.LabelValue("stefanprodan/swarmprom-node-exporter:v0.16.0"), "__meta_dockerswarm_service_label_com_docker_stack_namespace": model.LabelValue("mon"), "__meta_dockerswarm_service_mode": model.LabelValue("global"), "__meta_dockerswarm_service_name": model.LabelValue("mon_node-exporter"), "__meta_dockerswarm_task_container_id": model.LabelValue("85fcbc74e09fc86532773a757527fca6af60b81bfb4ef6962098c3ae46e0b0b9"), "__meta_dockerswarm_task_desired_state": model.LabelValue("running"), "__meta_dockerswarm_task_id": model.LabelValue("daxcdhbv3oupklh04l4sxy005"), "__meta_dockerswarm_task_port_publish_mode": model.LabelValue("ingress"), "__meta_dockerswarm_task_slot": model.LabelValue("0"), "__meta_dockerswarm_task_state": model.LabelValue("running"), }, { "__address__": model.LabelValue("10.0.0.10:9100"), "__meta_dockerswarm_network_id": model.LabelValue("qvwhwd6p61k4o0ulsknqb066z"), "__meta_dockerswarm_network_ingress": model.LabelValue("true"), "__meta_dockerswarm_network_internal": model.LabelValue("false"), "__meta_dockerswarm_network_name": model.LabelValue("ingress"), "__meta_dockerswarm_network_scope": model.LabelValue("swarm"), "__meta_dockerswarm_node_address": model.LabelValue("10.0.232.2"), "__meta_dockerswarm_node_availability": model.LabelValue("active"), "__meta_dockerswarm_node_hostname": model.LabelValue("master-2"), "__meta_dockerswarm_node_id": model.LabelValue("i9woemzxymn1n98o9ufebclgm"), "__meta_dockerswarm_node_platform_architecture": model.LabelValue("x86_64"), "__meta_dockerswarm_node_platform_os": model.LabelValue("linux"), "__meta_dockerswarm_node_role": model.LabelValue("manager"), "__meta_dockerswarm_node_status": model.LabelValue("ready"), "__meta_dockerswarm_service_id": model.LabelValue("3qvd7bwfptmoht16t1f7jllb6"), "__meta_dockerswarm_service_label_com_docker_stack_image": model.LabelValue("stefanprodan/swarmprom-node-exporter:v0.16.0"), "__meta_dockerswarm_service_label_com_docker_stack_namespace": model.LabelValue("mon"), "__meta_dockerswarm_service_mode": model.LabelValue("global"), "__meta_dockerswarm_service_name": model.LabelValue("mon_node-exporter"), "__meta_dockerswarm_task_container_id": model.LabelValue("f8e4457895c8ddf4723db4b129b55f904cf2ecde18dbf4a744c85470798813f9"), "__meta_dockerswarm_task_desired_state": model.LabelValue("running"), "__meta_dockerswarm_task_id": model.LabelValue("fwifn031bokjisimj5q76jwdc"), "__meta_dockerswarm_task_port_publish_mode": model.LabelValue("ingress"), "__meta_dockerswarm_task_slot": model.LabelValue("0"), "__meta_dockerswarm_task_state": model.LabelValue("running"), }, { "__address__": model.LabelValue("10.0.1.5:9100"), "__meta_dockerswarm_network_id": model.LabelValue("npq2closzy836m07eaq1425k3"), "__meta_dockerswarm_network_ingress": model.LabelValue("false"), "__meta_dockerswarm_network_internal": model.LabelValue("false"), "__meta_dockerswarm_network_label_com_docker_stack_namespace": model.LabelValue("mon"), "__meta_dockerswarm_network_name": model.LabelValue("mon_net"), "__meta_dockerswarm_network_scope": model.LabelValue("swarm"), "__meta_dockerswarm_node_address": model.LabelValue("10.0.232.2"), "__meta_dockerswarm_node_availability": model.LabelValue("active"), "__meta_dockerswarm_node_hostname": model.LabelValue("master-2"), "__meta_dockerswarm_node_id": model.LabelValue("i9woemzxymn1n98o9ufebclgm"), "__meta_dockerswarm_node_platform_architecture": model.LabelValue("x86_64"), "__meta_dockerswarm_node_platform_os": model.LabelValue("linux"), "__meta_dockerswarm_node_role": model.LabelValue("manager"), "__meta_dockerswarm_node_status": model.LabelValue("ready"), "__meta_dockerswarm_service_id": model.LabelValue("3qvd7bwfptmoht16t1f7jllb6"), "__meta_dockerswarm_service_label_com_docker_stack_image": model.LabelValue("stefanprodan/swarmprom-node-exporter:v0.16.0"), "__meta_dockerswarm_service_label_com_docker_stack_namespace": model.LabelValue("mon"), "__meta_dockerswarm_service_mode": model.LabelValue("global"), "__meta_dockerswarm_service_name": model.LabelValue("mon_node-exporter"), "__meta_dockerswarm_task_container_id": model.LabelValue("f8e4457895c8ddf4723db4b129b55f904cf2ecde18dbf4a744c85470798813f9"), "__meta_dockerswarm_task_desired_state": model.LabelValue("running"), "__meta_dockerswarm_task_id": model.LabelValue("fwifn031bokjisimj5q76jwdc"), "__meta_dockerswarm_task_port_publish_mode": model.LabelValue("ingress"), "__meta_dockerswarm_task_slot": model.LabelValue("0"), "__meta_dockerswarm_task_state": model.LabelValue("running"), }, { "__address__": model.LabelValue("10.0.0.19:9090"), "__meta_dockerswarm_network_id": model.LabelValue("qvwhwd6p61k4o0ulsknqb066z"), "__meta_dockerswarm_network_ingress": model.LabelValue("true"), "__meta_dockerswarm_network_internal": model.LabelValue("false"), "__meta_dockerswarm_network_name": model.LabelValue("ingress"), "__meta_dockerswarm_network_scope": model.LabelValue("swarm"), "__meta_dockerswarm_node_address": model.LabelValue("10.0.232.2"), "__meta_dockerswarm_node_availability": model.LabelValue("active"), "__meta_dockerswarm_node_hostname": model.LabelValue("master-2"), "__meta_dockerswarm_node_id": model.LabelValue("i9woemzxymn1n98o9ufebclgm"), "__meta_dockerswarm_node_platform_architecture": model.LabelValue("x86_64"), "__meta_dockerswarm_node_platform_os": model.LabelValue("linux"), "__meta_dockerswarm_node_role": model.LabelValue("manager"), "__meta_dockerswarm_node_status": model.LabelValue("ready"), "__meta_dockerswarm_service_id": model.LabelValue("tkv91uso46cck763aaqcb4rek"), "__meta_dockerswarm_service_label_com_docker_stack_image": model.LabelValue("stefanprodan/caddy"), "__meta_dockerswarm_service_label_com_docker_stack_namespace": model.LabelValue("mon"), "__meta_dockerswarm_service_mode": model.LabelValue("replicated"), "__meta_dockerswarm_service_name": model.LabelValue("mon_caddy"), "__meta_dockerswarm_task_container_id": model.LabelValue("5d00e145527f14d1bb2b13601000f1de9c95fc8ec1ccc1ff8291cadc31232957"), "__meta_dockerswarm_task_desired_state": model.LabelValue("running"), "__meta_dockerswarm_task_id": model.LabelValue("qtr16op0cz5pdbx4rylm7up4g"), "__meta_dockerswarm_task_port_publish_mode": model.LabelValue("ingress"), "__meta_dockerswarm_task_slot": model.LabelValue("1"), "__meta_dockerswarm_task_state": model.LabelValue("starting"), }, { "__address__": model.LabelValue("10.0.1.81:9090"), "__meta_dockerswarm_network_id": model.LabelValue("npq2closzy836m07eaq1425k3"), "__meta_dockerswarm_network_ingress": model.LabelValue("false"), "__meta_dockerswarm_network_internal": model.LabelValue("false"), "__meta_dockerswarm_network_label_com_docker_stack_namespace": model.LabelValue("mon"), "__meta_dockerswarm_network_name": model.LabelValue("mon_net"), "__meta_dockerswarm_network_scope": model.LabelValue("swarm"), "__meta_dockerswarm_node_address": model.LabelValue("10.0.232.2"), "__meta_dockerswarm_node_availability": model.LabelValue("active"), "__meta_dockerswarm_node_hostname": model.LabelValue("master-2"), "__meta_dockerswarm_node_id": model.LabelValue("i9woemzxymn1n98o9ufebclgm"), "__meta_dockerswarm_node_platform_architecture": model.LabelValue("x86_64"), "__meta_dockerswarm_node_platform_os": model.LabelValue("linux"), "__meta_dockerswarm_node_role": model.LabelValue("manager"), "__meta_dockerswarm_node_status": model.LabelValue("ready"), "__meta_dockerswarm_service_id": model.LabelValue("tkv91uso46cck763aaqcb4rek"), "__meta_dockerswarm_service_label_com_docker_stack_image": model.LabelValue("stefanprodan/caddy"), "__meta_dockerswarm_service_label_com_docker_stack_namespace": model.LabelValue("mon"), "__meta_dockerswarm_service_mode": model.LabelValue("replicated"), "__meta_dockerswarm_service_name": model.LabelValue("mon_caddy"), "__meta_dockerswarm_task_container_id": model.LabelValue("5d00e145527f14d1bb2b13601000f1de9c95fc8ec1ccc1ff8291cadc31232957"), "__meta_dockerswarm_task_desired_state": model.LabelValue("running"), "__meta_dockerswarm_task_id": model.LabelValue("qtr16op0cz5pdbx4rylm7up4g"), "__meta_dockerswarm_task_port_publish_mode": model.LabelValue("ingress"), "__meta_dockerswarm_task_slot": model.LabelValue("1"), "__meta_dockerswarm_task_state": model.LabelValue("starting"), }, { "__address__": model.LabelValue("10.0.0.19:9093"), "__meta_dockerswarm_network_id": model.LabelValue("qvwhwd6p61k4o0ulsknqb066z"), "__meta_dockerswarm_network_ingress": model.LabelValue("true"), "__meta_dockerswarm_network_internal": model.LabelValue("false"), "__meta_dockerswarm_network_name": model.LabelValue("ingress"), "__meta_dockerswarm_network_scope": model.LabelValue("swarm"), "__meta_dockerswarm_node_address": model.LabelValue("10.0.232.2"), "__meta_dockerswarm_node_availability": model.LabelValue("active"), "__meta_dockerswarm_node_hostname": model.LabelValue("master-2"), "__meta_dockerswarm_node_id": model.LabelValue("i9woemzxymn1n98o9ufebclgm"), "__meta_dockerswarm_node_platform_architecture": model.LabelValue("x86_64"), "__meta_dockerswarm_node_platform_os": model.LabelValue("linux"), "__meta_dockerswarm_node_role": model.LabelValue("manager"), "__meta_dockerswarm_node_status": model.LabelValue("ready"), "__meta_dockerswarm_service_id": model.LabelValue("tkv91uso46cck763aaqcb4rek"), "__meta_dockerswarm_service_label_com_docker_stack_image": model.LabelValue("stefanprodan/caddy"), "__meta_dockerswarm_service_label_com_docker_stack_namespace": model.LabelValue("mon"), "__meta_dockerswarm_service_mode": model.LabelValue("replicated"), "__meta_dockerswarm_service_name": model.LabelValue("mon_caddy"), "__meta_dockerswarm_task_container_id": model.LabelValue("5d00e145527f14d1bb2b13601000f1de9c95fc8ec1ccc1ff8291cadc31232957"), "__meta_dockerswarm_task_desired_state": model.LabelValue("running"), "__meta_dockerswarm_task_id": model.LabelValue("qtr16op0cz5pdbx4rylm7up4g"), "__meta_dockerswarm_task_port_publish_mode": model.LabelValue("ingress"), "__meta_dockerswarm_task_slot": model.LabelValue("1"), "__meta_dockerswarm_task_state": model.LabelValue("starting"), }, { "__address__": model.LabelValue("10.0.1.81:9093"), "__meta_dockerswarm_network_id": model.LabelValue("npq2closzy836m07eaq1425k3"), "__meta_dockerswarm_network_ingress": model.LabelValue("false"), "__meta_dockerswarm_network_internal": model.LabelValue("false"), "__meta_dockerswarm_network_label_com_docker_stack_namespace": model.LabelValue("mon"), "__meta_dockerswarm_network_name": model.LabelValue("mon_net"), "__meta_dockerswarm_network_scope": model.LabelValue("swarm"), "__meta_dockerswarm_node_address": model.LabelValue("10.0.232.2"), "__meta_dockerswarm_node_availability": model.LabelValue("active"), "__meta_dockerswarm_node_hostname": model.LabelValue("master-2"), "__meta_dockerswarm_node_id": model.LabelValue("i9woemzxymn1n98o9ufebclgm"), "__meta_dockerswarm_node_platform_architecture": model.LabelValue("x86_64"), "__meta_dockerswarm_node_platform_os": model.LabelValue("linux"), "__meta_dockerswarm_node_role": model.LabelValue("manager"), "__meta_dockerswarm_node_status": model.LabelValue("ready"), "__meta_dockerswarm_service_id": model.LabelValue("tkv91uso46cck763aaqcb4rek"), "__meta_dockerswarm_service_label_com_docker_stack_image": model.LabelValue("stefanprodan/caddy"), "__meta_dockerswarm_service_label_com_docker_stack_namespace": model.LabelValue("mon"), "__meta_dockerswarm_service_mode": model.LabelValue("replicated"), "__meta_dockerswarm_service_name": model.LabelValue("mon_caddy"), "__meta_dockerswarm_task_container_id": model.LabelValue("5d00e145527f14d1bb2b13601000f1de9c95fc8ec1ccc1ff8291cadc31232957"), "__meta_dockerswarm_task_desired_state": model.LabelValue("running"), "__meta_dockerswarm_task_id": model.LabelValue("qtr16op0cz5pdbx4rylm7up4g"), "__meta_dockerswarm_task_port_publish_mode": model.LabelValue("ingress"), "__meta_dockerswarm_task_slot": model.LabelValue("1"), "__meta_dockerswarm_task_state": model.LabelValue("starting"), }, { "__address__": model.LabelValue("10.0.0.19:9094"), "__meta_dockerswarm_network_id": model.LabelValue("qvwhwd6p61k4o0ulsknqb066z"), "__meta_dockerswarm_network_ingress": model.LabelValue("true"), "__meta_dockerswarm_network_internal": model.LabelValue("false"), "__meta_dockerswarm_network_name": model.LabelValue("ingress"), "__meta_dockerswarm_network_scope": model.LabelValue("swarm"), "__meta_dockerswarm_node_address": model.LabelValue("10.0.232.2"), "__meta_dockerswarm_node_availability": model.LabelValue("active"), "__meta_dockerswarm_node_hostname": model.LabelValue("master-2"), "__meta_dockerswarm_node_id": model.LabelValue("i9woemzxymn1n98o9ufebclgm"), "__meta_dockerswarm_node_platform_architecture": model.LabelValue("x86_64"), "__meta_dockerswarm_node_platform_os": model.LabelValue("linux"), "__meta_dockerswarm_node_role": model.LabelValue("manager"), "__meta_dockerswarm_node_status": model.LabelValue("ready"), "__meta_dockerswarm_service_id": model.LabelValue("tkv91uso46cck763aaqcb4rek"), "__meta_dockerswarm_service_label_com_docker_stack_image": model.LabelValue("stefanprodan/caddy"), "__meta_dockerswarm_service_label_com_docker_stack_namespace": model.LabelValue("mon"), "__meta_dockerswarm_service_mode": model.LabelValue("replicated"), "__meta_dockerswarm_service_name": model.LabelValue("mon_caddy"), "__meta_dockerswarm_task_container_id": model.LabelValue("5d00e145527f14d1bb2b13601000f1de9c95fc8ec1ccc1ff8291cadc31232957"), "__meta_dockerswarm_task_desired_state": model.LabelValue("running"), "__meta_dockerswarm_task_id": model.LabelValue("qtr16op0cz5pdbx4rylm7up4g"), "__meta_dockerswarm_task_port_publish_mode": model.LabelValue("ingress"), "__meta_dockerswarm_task_slot": model.LabelValue("1"), "__meta_dockerswarm_task_state": model.LabelValue("starting"), }, { "__address__": model.LabelValue("10.0.1.81:9094"), "__meta_dockerswarm_network_id": model.LabelValue("npq2closzy836m07eaq1425k3"), "__meta_dockerswarm_network_ingress": model.LabelValue("false"), "__meta_dockerswarm_network_internal": model.LabelValue("false"), "__meta_dockerswarm_network_label_com_docker_stack_namespace": model.LabelValue("mon"), "__meta_dockerswarm_network_name": model.LabelValue("mon_net"), "__meta_dockerswarm_network_scope": model.LabelValue("swarm"), "__meta_dockerswarm_node_address": model.LabelValue("10.0.232.2"), "__meta_dockerswarm_node_availability": model.LabelValue("active"), "__meta_dockerswarm_node_hostname": model.LabelValue("master-2"), "__meta_dockerswarm_node_id": model.LabelValue("i9woemzxymn1n98o9ufebclgm"), "__meta_dockerswarm_node_platform_architecture": model.LabelValue("x86_64"), "__meta_dockerswarm_node_platform_os": model.LabelValue("linux"), "__meta_dockerswarm_node_role": model.LabelValue("manager"), "__meta_dockerswarm_node_status": model.LabelValue("ready"), "__meta_dockerswarm_service_id": model.LabelValue("tkv91uso46cck763aaqcb4rek"), "__meta_dockerswarm_service_label_com_docker_stack_image": model.LabelValue("stefanprodan/caddy"), "__meta_dockerswarm_service_label_com_docker_stack_namespace": model.LabelValue("mon"), "__meta_dockerswarm_service_mode": model.LabelValue("replicated"), "__meta_dockerswarm_service_name": model.LabelValue("mon_caddy"), "__meta_dockerswarm_task_container_id": model.LabelValue("5d00e145527f14d1bb2b13601000f1de9c95fc8ec1ccc1ff8291cadc31232957"), "__meta_dockerswarm_task_desired_state": model.LabelValue("running"), "__meta_dockerswarm_task_id": model.LabelValue("qtr16op0cz5pdbx4rylm7up4g"), "__meta_dockerswarm_task_port_publish_mode": model.LabelValue("ingress"), "__meta_dockerswarm_task_slot": model.LabelValue("1"), "__meta_dockerswarm_task_state": model.LabelValue("starting"), }, { "__address__": model.LabelValue("10.0.0.16:3000"), "__meta_dockerswarm_network_id": model.LabelValue("qvwhwd6p61k4o0ulsknqb066z"), "__meta_dockerswarm_network_ingress": model.LabelValue("true"), "__meta_dockerswarm_network_internal": model.LabelValue("false"), "__meta_dockerswarm_network_name": model.LabelValue("ingress"), "__meta_dockerswarm_network_scope": model.LabelValue("swarm"), "__meta_dockerswarm_node_address": model.LabelValue("10.0.232.3"), "__meta_dockerswarm_node_availability": model.LabelValue("active"), "__meta_dockerswarm_node_hostname": model.LabelValue("master-3"), "__meta_dockerswarm_node_id": model.LabelValue("bvtjl7pnrtg0k88ywialsldpd"), "__meta_dockerswarm_node_platform_architecture": model.LabelValue("x86_64"), "__meta_dockerswarm_node_platform_os": model.LabelValue("linux"), "__meta_dockerswarm_node_role": model.LabelValue("manager"), "__meta_dockerswarm_node_status": model.LabelValue("ready"), "__meta_dockerswarm_service_id": model.LabelValue("uk9su5tb9ykfzew3qtmp14uzh"), "__meta_dockerswarm_service_label_com_docker_stack_image": model.LabelValue("stefanprodan/swarmprom-grafana:5.3.4"), "__meta_dockerswarm_service_label_com_docker_stack_namespace": model.LabelValue("mon"), "__meta_dockerswarm_service_mode": model.LabelValue("replicated"), "__meta_dockerswarm_service_name": model.LabelValue("mon_grafana"), "__meta_dockerswarm_task_container_id": model.LabelValue("5b4fc187b14eeba86381b50fc2ae652e74d6cbea5acae0bda72eaf3db0f59f0c"), "__meta_dockerswarm_task_desired_state": model.LabelValue("running"), "__meta_dockerswarm_task_id": model.LabelValue("tj683w0alx5hqaewks4rg0452"), "__meta_dockerswarm_task_port_publish_mode": model.LabelValue("ingress"), "__meta_dockerswarm_task_slot": model.LabelValue("1"), "__meta_dockerswarm_task_state": model.LabelValue("running"), }, { "__address__": model.LabelValue("10.0.1.30:3000"), "__meta_dockerswarm_network_id": model.LabelValue("npq2closzy836m07eaq1425k3"), "__meta_dockerswarm_network_ingress": model.LabelValue("false"), "__meta_dockerswarm_network_internal": model.LabelValue("false"), "__meta_dockerswarm_network_label_com_docker_stack_namespace": model.LabelValue("mon"), "__meta_dockerswarm_network_name": model.LabelValue("mon_net"), "__meta_dockerswarm_network_scope": model.LabelValue("swarm"), "__meta_dockerswarm_node_address": model.LabelValue("10.0.232.3"), "__meta_dockerswarm_node_availability": model.LabelValue("active"), "__meta_dockerswarm_node_hostname": model.LabelValue("master-3"), "__meta_dockerswarm_node_id": model.LabelValue("bvtjl7pnrtg0k88ywialsldpd"), "__meta_dockerswarm_node_platform_architecture": model.LabelValue("x86_64"), "__meta_dockerswarm_node_platform_os": model.LabelValue("linux"), "__meta_dockerswarm_node_role": model.LabelValue("manager"), "__meta_dockerswarm_node_status": model.LabelValue("ready"), "__meta_dockerswarm_service_id": model.LabelValue("uk9su5tb9ykfzew3qtmp14uzh"), "__meta_dockerswarm_service_label_com_docker_stack_image": model.LabelValue("stefanprodan/swarmprom-grafana:5.3.4"), "__meta_dockerswarm_service_label_com_docker_stack_namespace": model.LabelValue("mon"), "__meta_dockerswarm_service_mode": model.LabelValue("replicated"), "__meta_dockerswarm_service_name": model.LabelValue("mon_grafana"), "__meta_dockerswarm_task_container_id": model.LabelValue("5b4fc187b14eeba86381b50fc2ae652e74d6cbea5acae0bda72eaf3db0f59f0c"), "__meta_dockerswarm_task_desired_state": model.LabelValue("running"), "__meta_dockerswarm_task_id": model.LabelValue("tj683w0alx5hqaewks4rg0452"), "__meta_dockerswarm_task_port_publish_mode": model.LabelValue("ingress"), "__meta_dockerswarm_task_slot": model.LabelValue("1"), "__meta_dockerswarm_task_state": model.LabelValue("running"), }, { "__address__": model.LabelValue("10.0.232.3:82"), "__meta_dockerswarm_node_address": model.LabelValue("10.0.232.3"), "__meta_dockerswarm_node_availability": model.LabelValue("active"), "__meta_dockerswarm_node_hostname": model.LabelValue("master-3"), "__meta_dockerswarm_node_id": model.LabelValue("bvtjl7pnrtg0k88ywialsldpd"), "__meta_dockerswarm_node_platform_architecture": model.LabelValue("x86_64"), "__meta_dockerswarm_node_platform_os": model.LabelValue("linux"), "__meta_dockerswarm_node_role": model.LabelValue("manager"), "__meta_dockerswarm_node_status": model.LabelValue("ready"), "__meta_dockerswarm_service_id": model.LabelValue("ul5qawv4s7f7msm7dtyfarw80"), "__meta_dockerswarm_service_label_com_docker_stack_image": model.LabelValue("stefanprodan/caddy"), "__meta_dockerswarm_service_label_com_docker_stack_namespace": model.LabelValue("mon"), "__meta_dockerswarm_service_mode": model.LabelValue("global"), "__meta_dockerswarm_service_name": model.LabelValue("mon_dockerd-exporter"), "__meta_dockerswarm_task_container_id": model.LabelValue("dd50c428ebc7a7bd786c7b0db873bf53ed5cbe5312995a76eb8fd325dcf16032"), "__meta_dockerswarm_task_desired_state": model.LabelValue("running"), "__meta_dockerswarm_task_id": model.LabelValue("zhoo9feqxfyi9zg6acnt1eam2"), "__meta_dockerswarm_task_port_publish_mode": model.LabelValue("host"), "__meta_dockerswarm_task_slot": model.LabelValue("0"), "__meta_dockerswarm_task_state": model.LabelValue("running"), }, } { t.Run(fmt.Sprintf("item %d", i), func(t *testing.T) { testutil.Equals(t, lbls, tg.Targets[i]) }) } }