Skip to content

Commit

Permalink
WriteObject unit test and correctly get the string value for the reso…
Browse files Browse the repository at this point in the history
…urce hash
  • Loading branch information
peter-hazell authored and alexgeorgousis committed Jan 10, 2025
1 parent 9793841 commit 4fbc3d7
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions apis/pipelines/object_hasher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
package pipelines

import (
"fmt"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/sky-uk/kfp-operator/apis"
v1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

var _ = Context("ObjectHasher", func() {
Expand Down Expand Up @@ -198,4 +201,22 @@ var _ = Context("ObjectHasher", func() {
}
})
})

var _ = Describe("WriteObject", func() {

Specify("Different objects should have different hashes", func() {
oh1 := NewObjectHasher()
oh1.WriteObject(&v1.Deployment{
ObjectMeta: metav1.ObjectMeta{Name: "foo"},
})

oh2 := NewObjectHasher()
oh1.WriteObject(&v1.Deployment{
ObjectMeta: metav1.ObjectMeta{Name: "bar"},
})

fmt.Printf("%x", oh1.Sum())
Expect(oh1.Sum()).NotTo(Equal(oh2.Sum()))
})
})
})

0 comments on commit 4fbc3d7

Please sign in to comment.