Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
Signed-off-by: Antonino Fugazzotto <[email protected]>
  • Loading branch information
afugazzotto committed Jun 11, 2024
1 parent 0edab78 commit 3fcc35f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 51 deletions.
1 change: 1 addition & 0 deletions internal/controller/isbservicerollout_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ func (r *ISBServiceRolloutReconciler) reconcile(ctx context.Context, isbServiceR

// TODO: instead of doing this, modify the ApplyCRSpec below to be similar to what is done on the PipelineRollout controller code
if rolloutChildOp == RolloutChildNone {
numaLogger.Debug("InterStepBufferService spec is unchanged. No updates will be performed")
return nil
}

Expand Down
2 changes: 2 additions & 0 deletions internal/controller/pipelinerollout_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ func (r *PipelineRolloutReconciler) reconcile(
if err != nil {
return false, err
}
} else {
numaLogger.Debug("Pipeline spec is unchanged. No updates will be performed")
}

pipelineRollout.Status.MarkRunning()
Expand Down
51 changes: 0 additions & 51 deletions internal/controller/pipelinerollout_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -313,56 +312,6 @@ var _ = Describe("PipelineRollout Controller", func() {
})
})

func Test_makeChildResourceFromRolloutAndUpdateSpecHash_PipelineRollout(t *testing.T) {
ctx := context.Background()
restConfig := &rest.Config{}

pipelineRollout := &apiv1.PipelineRollout{
ObjectMeta: metav1.ObjectMeta{
Name: "pipeline-test",
Namespace: "default",
},
Spec: apiv1.PipelineRolloutSpec{
Pipeline: runtime.RawExtension{Raw: []byte(`{"key":"value"}`)},
},
}

obj, operation, err := makeChildResourceFromRolloutAndUpdateSpecHash(ctx, restConfig, pipelineRollout)

require.NoError(t, err)
assert.Equal(t, "Pipeline", obj.Kind)
assert.Equal(t, "numaflow.numaproj.io/v1alpha1", obj.APIVersion)
assert.Equal(t, pipelineRollout.Name, obj.Name)
assert.Equal(t, pipelineRollout.Namespace, obj.Namespace)
assert.Equal(t, []metav1.OwnerReference{*metav1.NewControllerRef(pipelineRollout, apiv1.PipelineRolloutGroupVersionKind)}, obj.OwnerReferences)
assert.Equal(t, operation, RolloutChildNew)
}

func Test_makeChildResourceFromRolloutAndUpdateSpecHash_ISBServiceRollout(t *testing.T) {
ctx := context.Background()
restConfig := &rest.Config{}

isbService := &apiv1.ISBServiceRollout{
ObjectMeta: metav1.ObjectMeta{
Name: "isbs-test",
Namespace: "default",
},
Spec: apiv1.ISBServiceRolloutSpec{
InterStepBufferService: runtime.RawExtension{Raw: []byte(`{"key":"value"}`)},
},
}

obj, operation, err := makeChildResourceFromRolloutAndUpdateSpecHash(ctx, restConfig, isbService)

require.NoError(t, err)
assert.Equal(t, "InterStepBufferService", obj.Kind)
assert.Equal(t, "numaflow.numaproj.io/v1alpha1", obj.APIVersion)
assert.Equal(t, isbService.Name, obj.Name)
assert.Equal(t, isbService.Namespace, obj.Namespace)
assert.Equal(t, []metav1.OwnerReference{*metav1.NewControllerRef(isbService, apiv1.ISBServiceRolloutGroupVersionKind)}, obj.OwnerReferences)
assert.Equal(t, operation, RolloutChildNew)
}

func Test_makeChildResourceFromRolloutAndUpdateSpecHash_InvalidType(t *testing.T) {
ctx := context.Background()
restConfig := &rest.Config{}
Expand Down

0 comments on commit 3fcc35f

Please sign in to comment.