Skip to content

Commit

Permalink
Removed unused functions
Browse files Browse the repository at this point in the history
  • Loading branch information
idlewis committed Apr 17, 2024
1 parent ec7079e commit 2bee396
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 58 deletions.
24 changes: 0 additions & 24 deletions utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/application-stacks/runtime-component-operator/common"
prometheusv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"

appstacksv1 "github.com/application-stacks/runtime-component-operator/api/v1"
routev1 "github.com/openshift/api/route/v1"
appsv1 "k8s.io/api/apps/v1"
autoscalingv1 "k8s.io/api/autoscaling/v1"
Expand Down Expand Up @@ -1217,29 +1216,6 @@ func CustomizeServiceMonitor(sm *prometheusv1.ServiceMonitor, ba common.BaseComp

}

// GetCondition ...
func GetCondition(conditionType appstacksv1.StatusConditionType, status *appstacksv1.RuntimeComponentStatus) *appstacksv1.StatusCondition {
for i := range status.Conditions {
if status.Conditions[i].Type == conditionType {
return &status.Conditions[i]
}
}

return nil
}

// SetCondition ...
func SetCondition(condition appstacksv1.StatusCondition, status *appstacksv1.RuntimeComponentStatus) {
for i := range status.Conditions {
if status.Conditions[i].Type == condition.Type {
status.Conditions[i] = condition
return
}
}

status.Conditions = append(status.Conditions, condition)
}

// GetWatchNamespaces returns a slice of namespaces the operator should watch based on WATCH_NAMESPSCE value
// WATCH_NAMESPSCE value could be empty for watching the whole cluster or a comma-separated list of namespaces
func GetWatchNamespaces() ([]string, error) {
Expand Down
34 changes: 0 additions & 34 deletions utils/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -675,40 +675,6 @@ func TestCustomizeServiceMonitor(t *testing.T) {
verifyTests(testSM, t)
}

func TestGetCondition(t *testing.T) {
logger := zap.New()
logf.SetLogger(logger)
status := &appstacksv1.RuntimeComponentStatus{
Conditions: []appstacksv1.StatusCondition{
{
Status: corev1.ConditionTrue,
Type: appstacksv1.StatusConditionTypeReconciled,
},
},
}
conditionType := appstacksv1.StatusConditionTypeReconciled
cond := GetCondition(conditionType, status)
testGC := []Test{{"Set status condition", status.Conditions[0].Status, cond.Status}}
verifyTests(testGC, t)
}

func TestSetCondition(t *testing.T) {
logger := zap.New()
logf.SetLogger(logger)
status := &appstacksv1.RuntimeComponentStatus{
Conditions: []appstacksv1.StatusCondition{
{Type: appstacksv1.StatusConditionTypeReconciled},
},
}
condition := appstacksv1.StatusCondition{
Status: corev1.ConditionTrue,
Type: appstacksv1.StatusConditionTypeReconciled,
}
SetCondition(condition, status)
testSC := []Test{{"Set status condition", condition.Status, status.Conditions[0].Status}}
verifyTests(testSC, t)
}

func TestGetWatchNamespaces(t *testing.T) {
// Set the logger to development mode for verbose logs
logger := zap.New()
Expand Down

0 comments on commit 2bee396

Please sign in to comment.