Skip to content

Commit

Permalink
feat: support testing statefulset
Browse files Browse the repository at this point in the history
  • Loading branch information
paddatrapper committed Apr 4, 2022
1 parent eb2e354 commit bfc9d96
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@ func TestDeploy(client kubernetes.Interface, ns string, deploymentName string, t
TestPodsByLabels(client, deploymentName, ns, labelMap, t)
}

func TestStatefulSet(client kubernetes.Interface, ns string, name string, t *console.TestResults) {
if client == nil {
t.Failf(name, "failed to get kubernetes client")
return
}

statefulset, err := client.AppsV1().StatefulSets(ns).Get(context.TODO(), name, metav1.GetOptions{})
if errors.IsNotFound(err) {
t.Failf(name, "statefulset not found")
return
}
labelMap, _ := metav1.LabelSelectorAsMap(statefulset.Spec.Selector)
TestPodsByLabels(client, name, ns, labelMap, t)
}

func TestDaemonSet(client kubernetes.Interface, ns string, name string, t *console.TestResults) {
testName := name
if client == nil {
Expand Down

0 comments on commit bfc9d96

Please sign in to comment.