Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
  • Loading branch information
pierDipi committed Oct 9, 2024
1 parent a87a95c commit 8172bc3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
13 changes: 7 additions & 6 deletions control-plane/pkg/apis/sources/v1/kafka_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

bindingsv1beta1 "knative.dev/eventing-kafka-broker/control-plane/pkg/apis/bindings/v1beta1"
"knative.dev/pkg/apis"
duckv1 "knative.dev/pkg/apis/duck/v1"

bindingsv1 "knative.dev/eventing-kafka-broker/control-plane/pkg/apis/bindings/v1"
)

func TestKafka_Validate(t *testing.T) {
Expand All @@ -44,7 +45,7 @@ func TestKafka_Validate(t *testing.T) {
ks: &KafkaSource{
Spec: KafkaSourceSpec{
Topics: []string{"test-topic"},
KafkaAuthSpec: bindingsv1beta1.KafkaAuthSpec{},
KafkaAuthSpec: bindingsv1.KafkaAuthSpec{},
ConsumerGroup: "ks-group",
SourceSpec: duckv1.SourceSpec{
Sink: NewSourceSinkReference(),
Expand All @@ -58,7 +59,7 @@ func TestKafka_Validate(t *testing.T) {
name: "no topics",
ks: &KafkaSource{
Spec: KafkaSourceSpec{
KafkaAuthSpec: bindingsv1beta1.KafkaAuthSpec{
KafkaAuthSpec: bindingsv1.KafkaAuthSpec{
BootstrapServers: []string{"kafka:9092"},
},
ConsumerGroup: "ks-group",
Expand All @@ -75,7 +76,7 @@ func TestKafka_Validate(t *testing.T) {
ks: &KafkaSource{
Spec: KafkaSourceSpec{
Topics: []string{"test-topic"},
KafkaAuthSpec: bindingsv1beta1.KafkaAuthSpec{
KafkaAuthSpec: bindingsv1.KafkaAuthSpec{
BootstrapServers: []string{"kafka:9092"},
},
Ordering: &badOrdering,
Expand All @@ -93,7 +94,7 @@ func TestKafka_Validate(t *testing.T) {
ks: &KafkaSource{
Spec: KafkaSourceSpec{
Topics: []string{"test-topic"},
KafkaAuthSpec: bindingsv1beta1.KafkaAuthSpec{
KafkaAuthSpec: bindingsv1.KafkaAuthSpec{
BootstrapServers: []string{"kafka:9092"},
},
Ordering: &validOrdering,
Expand All @@ -111,7 +112,7 @@ func TestKafka_Validate(t *testing.T) {
ks: &KafkaSource{
Spec: KafkaSourceSpec{
Topics: []string{"test-topic"},
KafkaAuthSpec: bindingsv1beta1.KafkaAuthSpec{
KafkaAuthSpec: bindingsv1.KafkaAuthSpec{
BootstrapServers: []string{"kafka:9092"},
},
InitialOffset: badInitialOffset,
Expand Down
7 changes: 4 additions & 3 deletions control-plane/pkg/apis/sources/v1beta1/kafka_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ import (
"strconv"

"github.com/google/uuid"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"

"knative.dev/eventing-kafka-broker/control-plane/pkg/apis/sources/config"
"knative.dev/pkg/apis"

"knative.dev/eventing-kafka-broker/control-plane/pkg/apis/sources/config"
)

const (
Expand All @@ -47,7 +48,7 @@ func (k *KafkaSource) SetDefaults(ctx context.Context) {
}

if k.Spec.Consumers == nil {
k.Spec.Consumers = pointer.Int32(1)
k.Spec.Consumers = ptr.To(int32(1))
}

if k.Spec.InitialOffset == "" {
Expand Down

0 comments on commit 8172bc3

Please sign in to comment.