Skip to content

Commit

Permalink
Added test for SetControlPlaneEndpoint() function
Browse files Browse the repository at this point in the history
  • Loading branch information
abdurrehman107 committed Oct 12, 2023
1 parent 1d940ce commit 7c71490
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions controllers/hetznercluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ package controllers

import (
"context"
"testing"
"time"

"github.com/hetznercloud/hcloud-go/v2/hcloud"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/ptr"
Expand Down Expand Up @@ -840,3 +842,31 @@ var _ = Describe("reconcileRateLimit", func() {
Expect(reconcileRateLimit(hetznerCluster, testEnv.RateLimitWaitTime)).To(BeFalse())
})
})

func TestSetControlPlaneEndpoint(t *testing.T) {
type args struct {
hetznerCluster *infrav1.HetznerCluster
}
tests := []struct{
name string
args args
want bool
}{
{
name: "should return true",
args: args{hetznerCluster: new(infrav1.HetznerCluster)},
want: true,
},
{
name: "should return false",
args: args{hetznerCluster: new(infrav1.HetznerCluster)},
want: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T){
got := SetControlPlaneEndpoint(tt.args.hetznerCluster)
assert.Equal(t, tt.want, got)
})
}
}

0 comments on commit 7c71490

Please sign in to comment.