github.com/kubeshop/testkube@v1.17.23/contrib/executor/jmeterd/pkg/slaves/meta.go (about)

     1  package slaves
     2  
     3  import (
     4  	"strings"
     5  
     6  	"golang.org/x/exp/slices"
     7  )
     8  
     9  type SlaveMeta map[string]string
    10  
    11  func (m *SlaveMeta) Names() []string {
    12  	var names []string
    13  	for k := range *m {
    14  		names = append(names, k)
    15  	}
    16  	return names
    17  }
    18  
    19  func (m *SlaveMeta) IPs() []string {
    20  	var ips []string
    21  	for _, v := range *m {
    22  		ips = append(ips, v)
    23  	}
    24  	return ips
    25  }
    26  
    27  func (m *SlaveMeta) ToIPString() string {
    28  	ips := m.IPs()
    29  	slices.Sort(ips)
    30  	return strings.Join(m.IPs(), ",")
    31  }