Skip to content

Commit

Permalink
Updated some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
missylbytes committed Jul 8, 2024
1 parent 92bcb82 commit 6a99515
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions control-plane/connect-inject/common/openshift_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ import (
//}

func TestGetDataplaneIDs(t *testing.T) {
dataplaneImage := "consul-dataplane"
k8sImage := "consul-k8s-control-plane"
cases := []struct {
Name string
Namespace corev1.Namespace
Expand Down Expand Up @@ -219,15 +221,15 @@ func TestGetDataplaneIDs(t *testing.T) {
t.Run(tt.Name, func(t *testing.T) {
require := require.New(t)
// Test UID
actualUIDs, err := GetDataplaneUID(tt.Namespace, tt.Pod)
actualUIDs, err := GetDataplaneUID(tt.Namespace, tt.Pod, dataplaneImage, k8sImage)
if tt.Err == "" {
require.NoError(err)
require.Equal(tt.ExpectedDataplaneUserAndGroupIDs, actualUIDs)
} else {
require.EqualError(err, tt.Err)
}
// Test GroupID
actualGroupIDs, err := GetDataplaneGroupID(tt.Namespace, tt.Pod)
actualGroupIDs, err := GetDataplaneGroupID(tt.Namespace, tt.Pod, dataplaneImage, k8sImage)
if tt.Err == "" {
require.NoError(err)
require.Equal(tt.ExpectedDataplaneUserAndGroupIDs, actualGroupIDs)
Expand All @@ -239,6 +241,8 @@ func TestGetDataplaneIDs(t *testing.T) {
}

func TestGetAvailableIDs(t *testing.T) {
dataplaneImage := "consul-dataplane"
k8sImage := "consul-k8s-control-plane"
cases := []struct {
Name string
Namespace corev1.Namespace
Expand Down Expand Up @@ -338,14 +342,14 @@ func TestGetAvailableIDs(t *testing.T) {
for _, tt := range cases {
t.Run(tt.Name, func(t *testing.T) {
require := require.New(t)
actualUserIDs, err := getAvailableIDs(tt.Namespace, tt.Pod, constants.AnnotationOpenShiftUIDRange)
actualUserIDs, err := getAvailableIDs(tt.Namespace, tt.Pod, constants.AnnotationOpenShiftUIDRange, dataplaneImage, k8sImage)
if tt.Err == "" {
require.NoError(err)
require.Equal(tt.ExpectedAvailableUserIDs, actualUserIDs)
} else {
require.EqualError(err, tt.Err)
}
actualGroupIDs, err := getAvailableIDs(tt.Namespace, tt.Pod, constants.AnnotationOpenShiftGroups)
actualGroupIDs, err := getAvailableIDs(tt.Namespace, tt.Pod, constants.AnnotationOpenShiftGroups, dataplaneImage, k8sImage)
if tt.Err == "" {
require.NoError(err)
require.Equal(tt.ExpectedAvailableGroupIDs, actualGroupIDs)
Expand Down

0 comments on commit 6a99515

Please sign in to comment.