Skip to content

Commit

Permalink
fixed some test cases
Browse files Browse the repository at this point in the history
Signed-off-by: vivekr-splunk <94569031+vivekr-splunk@users.noreply.github.com>
  • Loading branch information
vivekr-splunk committed Aug 23, 2023
1 parent 4214cb5 commit 155ca93
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions pkg/splunk/enterprise/clustermanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1511,6 +1511,7 @@ func TestChangeClusterManagerAnnotations(t *testing.T) {
Spec: enterpriseApi.LicenseManagerSpec{
CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{
Spec: enterpriseApi.Spec{
Image : "splunk/splunk:latest",
ImagePullPolicy: "Always",
},
Volumes: []corev1.Volume{},
Expand All @@ -1526,6 +1527,7 @@ func TestChangeClusterManagerAnnotations(t *testing.T) {
Spec: enterpriseApi.ClusterManagerSpec{
CommonSplunkSpec: enterpriseApi.CommonSplunkSpec{
Spec: enterpriseApi.Spec{
Image : "splunk/splunk:latest",
ImagePullPolicy: "Always",
},
Volumes: []corev1.Volume{},
Expand Down Expand Up @@ -1556,12 +1558,35 @@ func TestChangeClusterManagerAnnotations(t *testing.T) {
if err != nil {
t.Errorf("changeLicenseManagerAnnotations should not have returned error=%v", err)
}

// create pods for license manager
createPods(t, ctx, client, "license-manager", fmt.Sprintf("splunk-%s-license-manager-0", lm.Name), lm.Namespace, lm.Spec.Image)
updateStatefulSetsInTest(t, ctx, client, 1, fmt.Sprintf("splunk-%s-license-manager", lm.Name), lm.Namespace)
lm.Status.TelAppInstalled = true
// create license manager statefulset
_, err = ApplyLicenseManager(ctx, client, lm)
if err != nil {
t.Errorf("ApplyLicenseManager should not have returned error; err=%v", err)
}

err = client.Get(ctx, namespacedName, lm)
if err != nil {
t.Errorf("changeLicenseManagerAnnotations should not have returned error=%v", err)
}

lm.Status.Phase = enterpriseApi.PhaseReady
err = client.Status().Update(ctx, lm)
if err != nil {
t.Errorf("Unexpected update pod %v", err)
debug.PrintStack()
}


VerifyCMisMultisiteCall = func(ctx context.Context, cr *enterpriseApi.ClusterManager, namespaceScopedSecret *corev1.Secret) ([]corev1.EnvVar, error) {
extraEnv := getClusterManagerExtraEnv(cr, &cr.Spec.CommonSplunkSpec)
return extraEnv, err
}

client.Create(ctx, cm)
_, err = ApplyClusterManager(ctx, client, cm)
if err != nil {
Expand Down

0 comments on commit 155ca93

Please sign in to comment.