Skip to content

Commit

Permalink
Merge pull request #81 from flanksource/feature/test-statefulset
Browse files Browse the repository at this point in the history
feat: support testing statefulset
  • Loading branch information
moshloop authored Apr 4, 2022
2 parents eb2e354 + bfc9d96 commit b1af0fc
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 b1af0fc

Please sign in to comment.