github.com/kubeshop/testkube@v1.17.23/cmd/tcl/testworkflow-toolkit/common/labels.go (about)

     1  // Copyright 2024 Testkube.
     2  //
     3  // Licensed as a Testkube Pro file under the Testkube Community
     4  // License (the "License"); you may not use this file except in compliance with
     5  // the License. You may obtain a copy of the License at
     6  //
     7  //	https://github.com/kubeshop/testkube/blob/main/licenses/TCL.txt
     8  
     9  package common
    10  
    11  import (
    12  	"fmt"
    13  	"strings"
    14  
    15  	"github.com/kubeshop/testkube/pkg/ui"
    16  )
    17  
    18  func ServiceLabel(name string) string {
    19  	return ui.LightCyan(name)
    20  }
    21  
    22  func InstanceLabel(name string, index int64, total int64) string {
    23  	zeros := strings.Repeat("0", len(fmt.Sprintf("%d", total))-len(fmt.Sprintf("%d", index+1)))
    24  	return ServiceLabel(name) + ui.Cyan(fmt.Sprintf("/%s%d", zeros, index+1))
    25  }