mirror of
https://github.com/rancher/k3k.git
synced 2026-08-18 20:07:06 +00:00
fix tests
This commit is contained in:
@@ -2,9 +2,10 @@ package server
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/rancher/k3k/pkg/apis/k3k.io/v1beta1"
|
||||
@@ -43,6 +44,9 @@ func Test_BuildServerConfig(t *testing.T) {
|
||||
Name: testClusterName,
|
||||
Namespace: testClusterNamespace,
|
||||
},
|
||||
Spec: v1beta1.ClusterSpec{
|
||||
Mode: v1beta1.SharedClusterMode,
|
||||
},
|
||||
Status: v1beta1.ClusterStatus{
|
||||
ClusterCIDR: defaultSharedClusterCIDR,
|
||||
ServiceCIDR: defaultSharedServiceCIDR,
|
||||
@@ -71,6 +75,9 @@ func Test_BuildServerConfig(t *testing.T) {
|
||||
Name: testClusterName,
|
||||
Namespace: testClusterNamespace,
|
||||
},
|
||||
Spec: v1beta1.ClusterSpec{
|
||||
Mode: v1beta1.SharedClusterMode,
|
||||
},
|
||||
Status: v1beta1.ClusterStatus{
|
||||
ClusterCIDR: defaultSharedClusterCIDR,
|
||||
ServiceCIDR: defaultSharedServiceCIDR,
|
||||
@@ -158,6 +165,7 @@ func Test_BuildServerConfig(t *testing.T) {
|
||||
Namespace: testClusterNamespace,
|
||||
},
|
||||
Spec: v1beta1.ClusterSpec{
|
||||
Mode: v1beta1.SharedClusterMode,
|
||||
ClusterDNS: testClusterDNS,
|
||||
},
|
||||
Status: v1beta1.ClusterStatus{
|
||||
@@ -186,9 +194,7 @@ func Test_BuildServerConfig(t *testing.T) {
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
serverConfig := buildServerConfig(tt.args.cluster, tt.args.initServer, tt.args.serviceIP, tt.args.token)
|
||||
if !reflect.DeepEqual(tt.expectedData, serverConfig) {
|
||||
t.Errorf("found %v, expected %v", serverConfig, tt.expectedData)
|
||||
}
|
||||
assert.Equal(t, tt.expectedData, serverConfig)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user