...

Source file src/edge-infra.dev/pkg/k8s/meta/types_test.go

Documentation: edge-infra.dev/pkg/k8s/meta

     1  package meta
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  // Naive test which ensures we have coverage of all resource Kinds which
     8  // are workloads
     9  func TestWorkloadKind(t *testing.T) {
    10  	tcs := []struct {
    11  		kind     string
    12  		expected bool
    13  	}{
    14  		{kind: "Deployment", expected: true},
    15  		{kind: "DaemonSet", expected: true},
    16  		{kind: "StatefulSet", expected: true},
    17  		{kind: "Job", expected: true},
    18  		{kind: "CronJob", expected: true},
    19  		{kind: "RoleBinding", expected: false},
    20  		{kind: "ClusterRole", expected: false},
    21  	}
    22  
    23  	for _, tc := range tcs {
    24  		if ok := IsWorkload(tc.kind); ok != tc.expected {
    25  			t.Errorf("\n%s: Expected:\n%v\nGot:\n%v\n", tc.kind, tc.expected, ok)
    26  		}
    27  	}
    28  }
    29  

View as plain text