istio.io/istio@v0.0.0-20240520182934-d79c90f27776/pkg/test/framework/label/labels.go (about)

     1  // Copyright Istio Authors
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package label
    16  
    17  const (
    18  	// Postsubmit indicates that the test should be run as part of a postsubmit run only.
    19  	Postsubmit Instance = "postsubmit"
    20  
    21  	// CustomSetup indicates that the test requires a custom Istio installation.
    22  	CustomSetup Instance = "customsetup"
    23  
    24  	// IPv4 indicates a test is only compatible with IPv4 clusters.
    25  	// Any usage of this should have an associated GitHub issue to make it compatible with IPv6
    26  	IPv4 Instance = "ipv4"
    27  )
    28  
    29  var all = NewSet(
    30  	Postsubmit,
    31  	CustomSetup,
    32  	IPv4)
    33  
    34  // Find the label with the given name
    35  func Find(name string) (Instance, bool) {
    36  	candidate := Instance(name)
    37  	if _, ok := all[candidate]; ok {
    38  		return candidate, true
    39  	}
    40  
    41  	return "", false
    42  }