Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 0 additions & 54 deletions .github/workflows/cla-check.yml

This file was deleted.

37 changes: 11 additions & 26 deletions internal/controller/clustermaster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ package controller

import (
"context"
"fmt"

"github.com/splunk/splunk-operator/internal/controller/testutils"

enterpriseApi "github.com/splunk/splunk-operator/api/v4"

"time"

enterpriseApiV3 "github.com/splunk/splunk-operator/api/v3"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
Expand All @@ -25,10 +22,6 @@ import (

var _ = Describe("ClusterMaster Controller", func() {

BeforeEach(func() {
time.Sleep(2 * time.Second)
})

AfterEach(func() {

})
Expand Down Expand Up @@ -151,20 +144,16 @@ func CreateClusterMaster(name string, namespace string, annotations map[string]s
}
ssSpec := testutils.NewClusterMaster(name, namespace, "image")
Expect(k8sClient.Create(context.Background(), ssSpec)).Should(Succeed())
time.Sleep(2 * time.Second)

By("Expecting ClusterMaster custom resource to be created successfully")
ss := &enterpriseApiV3.ClusterMaster{}
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, ss)
if status != "" {
fmt.Printf("status is set to %v", status)
ss.Status.Phase = status
Expect(k8sClient.Status().Update(context.Background(), ss)).Should(Succeed())
time.Sleep(2 * time.Second)
}
return true
return k8sClient.Get(context.Background(), key, ss) == nil
}, timeout, interval).Should(BeTrue())
if status != "" {
ss.Status.Phase = status
Expect(k8sClient.Status().Update(context.Background(), ss)).Should(Succeed())
}

return ss
}
Expand All @@ -178,20 +167,16 @@ func UpdateClusterMaster(instance *enterpriseApiV3.ClusterMaster, status enterpr
ssSpec := testutils.NewClusterMaster(instance.Name, instance.Namespace, "image")
ssSpec.ResourceVersion = instance.ResourceVersion
Expect(k8sClient.Update(context.Background(), ssSpec)).Should(Succeed())
time.Sleep(2 * time.Second)

By("Expecting ClusterMaster custom resource to be created successfully")
By("Expecting ClusterMaster custom resource to be updated successfully")
ss := &enterpriseApiV3.ClusterMaster{}
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, ss)
if status != "" {
fmt.Printf("status is set to %v", status)
ss.Status.Phase = status
Expect(k8sClient.Status().Update(context.Background(), ss)).Should(Succeed())
time.Sleep(2 * time.Second)
}
return true
return k8sClient.Get(context.Background(), key, ss) == nil
}, timeout, interval).Should(BeTrue())
if status != "" {
ss.Status.Phase = status
Expect(k8sClient.Status().Update(context.Background(), ss)).Should(Succeed())
}

return ss
}
Expand Down
37 changes: 11 additions & 26 deletions internal/controller/licensemanager_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@ package controller

import (
"context"
"fmt"

"github.com/splunk/splunk-operator/internal/controller/testutils"

enterpriseApi "github.com/splunk/splunk-operator/api/v4"
"sigs.k8s.io/controller-runtime/pkg/client/fake"

"time"

"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/reconcile"

Expand All @@ -24,10 +21,6 @@ import (

var _ = Describe("LicenseManager Controller", func() {

BeforeEach(func() {
time.Sleep(2 * time.Second)
})

AfterEach(func() {

})
Expand Down Expand Up @@ -148,20 +141,16 @@ func CreateLicenseManager(name string, namespace string, annotations map[string]
}
ssSpec := testutils.NewLicenseManager(name, namespace, "image")
Expect(k8sClient.Create(context.Background(), ssSpec)).Should(Succeed())
time.Sleep(2 * time.Second)

By("Expecting LicenseManager custom resource to be created successfully")
ss := &enterpriseApi.LicenseManager{}
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, ss)
if status != "" {
fmt.Printf("status is set to %v", status)
ss.Status.Phase = status
Expect(k8sClient.Status().Update(context.Background(), ss)).Should(Succeed())
time.Sleep(2 * time.Second)
}
return true
return k8sClient.Get(context.Background(), key, ss) == nil
}, timeout, interval).Should(BeTrue())
if status != "" {
ss.Status.Phase = status
Expect(k8sClient.Status().Update(context.Background(), ss)).Should(Succeed())
}

return ss
}
Expand All @@ -175,20 +164,16 @@ func UpdateLicenseManager(instance *enterpriseApi.LicenseManager, status enterpr
ssSpec := testutils.NewLicenseManager(instance.Name, instance.Namespace, "image")
ssSpec.ResourceVersion = instance.ResourceVersion
Expect(k8sClient.Update(context.Background(), ssSpec)).Should(Succeed())
time.Sleep(2 * time.Second)

By("Expecting LicenseManager custom resource to be created successfully")
By("Expecting LicenseManager custom resource to be updated successfully")
ss := &enterpriseApi.LicenseManager{}
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, ss)
if status != "" {
fmt.Printf("status is set to %v", status)
ss.Status.Phase = status
Expect(k8sClient.Status().Update(context.Background(), ss)).Should(Succeed())
time.Sleep(2 * time.Second)
}
return true
return k8sClient.Get(context.Background(), key, ss) == nil
}, timeout, interval).Should(BeTrue())
if status != "" {
ss.Status.Phase = status
Expect(k8sClient.Status().Update(context.Background(), ss)).Should(Succeed())
}

return ss
}
Expand Down
37 changes: 11 additions & 26 deletions internal/controller/licensemaster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@ package controller

import (
"context"
"fmt"

"github.com/splunk/splunk-operator/internal/controller/testutils"

enterpriseApi "github.com/splunk/splunk-operator/api/v4"
"sigs.k8s.io/controller-runtime/pkg/client/fake"

"time"

enterpriseApiV3 "github.com/splunk/splunk-operator/api/v3"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
Expand All @@ -25,10 +22,6 @@ import (

var _ = Describe("LicenseMaster Controller", func() {

BeforeEach(func() {
time.Sleep(2 * time.Second)
})

AfterEach(func() {

})
Expand Down Expand Up @@ -149,20 +142,16 @@ func CreateLicenseMaster(name string, namespace string, annotations map[string]s
}
ssSpec := testutils.NewLicenseMaster(name, namespace, "image")
Expect(k8sClient.Create(context.Background(), ssSpec)).Should(Succeed())
time.Sleep(2 * time.Second)

By("Expecting LicenseMaster custom resource to be created successfully")
ss := &enterpriseApiV3.LicenseMaster{}
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, ss)
if status != "" {
fmt.Printf("status is set to %v", status)
ss.Status.Phase = status
Expect(k8sClient.Status().Update(context.Background(), ss)).Should(Succeed())
time.Sleep(2 * time.Second)
}
return true
return k8sClient.Get(context.Background(), key, ss) == nil
}, timeout, interval).Should(BeTrue())
if status != "" {
ss.Status.Phase = status
Expect(k8sClient.Status().Update(context.Background(), ss)).Should(Succeed())
}

return ss
}
Expand All @@ -176,20 +165,16 @@ func UpdateLicenseMaster(instance *enterpriseApiV3.LicenseMaster, status enterpr
ssSpec := testutils.NewLicenseMaster(instance.Name, instance.Namespace, "image")
ssSpec.ResourceVersion = instance.ResourceVersion
Expect(k8sClient.Update(context.Background(), ssSpec)).Should(Succeed())
time.Sleep(2 * time.Second)

By("Expecting LicenseMaster custom resource to be created successfully")
By("Expecting LicenseMaster custom resource to be updated successfully")
ss := &enterpriseApiV3.LicenseMaster{}
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, ss)
if status != "" {
fmt.Printf("status is set to %v", status)
ss.Status.Phase = status
Expect(k8sClient.Status().Update(context.Background(), ss)).Should(Succeed())
time.Sleep(2 * time.Second)
}
return true
return k8sClient.Get(context.Background(), key, ss) == nil
}, timeout, interval).Should(BeTrue())
if status != "" {
ss.Status.Phase = status
Expect(k8sClient.Status().Update(context.Background(), ss)).Should(Succeed())
}

return ss
}
Expand Down
37 changes: 11 additions & 26 deletions internal/controller/monitoringconsole_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ package controller

import (
"context"
"fmt"

"github.com/splunk/splunk-operator/internal/controller/testutils"

enterpriseApi "github.com/splunk/splunk-operator/api/v4"

"time"

"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
Expand All @@ -24,10 +21,6 @@ import (

var _ = Describe("MonitoringConsole Controller", func() {

BeforeEach(func() {
time.Sleep(2 * time.Second)
})

AfterEach(func() {

})
Expand Down Expand Up @@ -148,20 +141,16 @@ func CreateMonitoringConsole(name string, namespace string, annotations map[stri
}
ssSpec := testutils.NewMonitoringConsole(name, namespace, "image")
Expect(k8sClient.Create(context.Background(), ssSpec)).Should(Succeed())
time.Sleep(2 * time.Second)

By("Expecting MonitoringConsole custom resource to be created successfully")
ss := &enterpriseApi.MonitoringConsole{}
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, ss)
if status != "" {
fmt.Printf("status is set to %v", status)
ss.Status.Phase = status
Expect(k8sClient.Status().Update(context.Background(), ss)).Should(Succeed())
time.Sleep(2 * time.Second)
}
return true
return k8sClient.Get(context.Background(), key, ss) == nil
}, timeout, interval).Should(BeTrue())
if status != "" {
ss.Status.Phase = status
Expect(k8sClient.Status().Update(context.Background(), ss)).Should(Succeed())
}

return ss
}
Expand All @@ -175,20 +164,16 @@ func UpdateMonitoringConsole(instance *enterpriseApi.MonitoringConsole, status e
ssSpec := testutils.NewMonitoringConsole(instance.Name, instance.Namespace, "image")
ssSpec.ResourceVersion = instance.ResourceVersion
Expect(k8sClient.Update(context.Background(), ssSpec)).Should(Succeed())
time.Sleep(2 * time.Second)

By("Expecting MonitoringConsole custom resource to be created successfully")
By("Expecting MonitoringConsole custom resource to be updated successfully")
ss := &enterpriseApi.MonitoringConsole{}
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, ss)
if status != "" {
fmt.Printf("status is set to %v", status)
ss.Status.Phase = status
Expect(k8sClient.Status().Update(context.Background(), ss)).Should(Succeed())
time.Sleep(2 * time.Second)
}
return true
return k8sClient.Get(context.Background(), key, ss) == nil
}, timeout, interval).Should(BeTrue())
if status != "" {
ss.Status.Phase = status
Expect(k8sClient.Status().Update(context.Background(), ss)).Should(Succeed())
}

return ss
}
Expand Down
Loading
Loading