-
Notifications
You must be signed in to change notification settings - Fork 116
/
Copy pathverificationutils.go
47 lines (41 loc) · 2.08 KB
/
verificationutils.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package testenv
import (
gomega "github.com/onsi/gomega"
enterprisev1 "github.com/splunk/splunk-operator/pkg/apis/enterprise/v1beta1"
splcommon "github.com/splunk/splunk-operator/pkg/splunk/common"
)
// StandaloneReady verify Standlone is in ReadyStatus and does not flip-flop
func StandaloneReady(deployment *Deployment, deploymentName string, standalone *enterprisev1.Standalone, testenvInstance *TestEnv) {
gomega.Eventually(func() splcommon.Phase {
err := deployment.GetInstance(deploymentName, standalone)
if err != nil {
return splcommon.PhaseError
}
testenvInstance.Log.Info("Waiting for standalone STATUS to be ready", "instance", standalone.ObjectMeta.Name, "Phase", standalone.Status.Phase)
DumpGetPods(testenvInstance.GetName())
return standalone.Status.Phase
}, deployment.GetTimeout(), PollInterval).Should(gomega.Equal(splcommon.PhaseReady))
// In a steady state, we should stay in Ready and not flip-flop around
gomega.Consistently(func() splcommon.Phase {
_ = deployment.GetInstance(deployment.GetName(), standalone)
return standalone.Status.Phase
}, ConsistentDuration, ConsistentPollInterval).Should(gomega.Equal(splcommon.PhaseReady))
}
// SearchHeadClusterReady verify SHC is in READY status and does not flip-flop
func SearchHeadClusterReady(deployment *Deployment, testenvInstance *TestEnv) {
shc := &enterprisev1.SearchHeadCluster{}
gomega.Eventually(func() splcommon.Phase {
err := deployment.GetInstance(deployment.GetName(), shc)
if err != nil {
return splcommon.PhaseError
}
testenvInstance.Log.Info("Waiting for search head cluster STATUS to be ready", "instance", shc.ObjectMeta.Name, "Phase", shc.Status.Phase)
DumpGetPods(testenvInstance.GetName())
return shc.Status.Phase
}, deployment.GetTimeout(), PollInterval).Should(gomega.Equal(splcommon.PhaseReady))
// In a steady state, we should stay in Ready and not flip-flop around
gomega.Consistently(func() splcommon.Phase {
_ = deployment.GetInstance(deployment.GetName(), shc)
return shc.Status.Phase
}, ConsistentDuration, ConsistentPollInterval).Should(gomega.Equal(splcommon.PhaseReady))
}