Skip to content

Commit 04162e4

Browse files
committed
fix: update path to the template files after moving the utils package
1 parent 147b400 commit 04162e4

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ RUN go mod download
1313
COPY main.go main.go
1414
COPY apis/ apis/
1515
COPY controllers/ controllers/
16-
COPY utils/ utils/
1716
COPY pkg/ pkg/
1817
COPY metrics/ metrics/
1918

controllers/controlplane/kopscontrolplane_controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2438,7 +2438,7 @@ func TestPrepareCustomCloudResources(t *testing.T) {
24382438
}
24392439

24402440
terraformOutputDir := fmt.Sprintf("/tmp/%s", kopsCluster.Name)
2441-
templateTestDir := "../../utils/templates/tests"
2441+
templateTestDir := "../../pkg/utils/templates/tests"
24422442

24432443
dataDummyContent, err := os.ReadFile(templateTestDir + "/data/dummy_data")
24442444
g.Expect(err).NotTo(HaveOccurred())

pkg/utils/karpenter_utils_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func TestCreateEC2NodeClassFromKopsLaunchTemplateInfo(t *testing.T) {
7676
ec2NodeClassString, err := CreateEC2NodeClassFromKopsLaunchTemplateInfo(kopsCluster, kmp, kmp.Name, terraformOutputDir)
7777
if tc.expectedError != nil {
7878
g.Expect(err).To(HaveOccurred())
79-
g.Expect(err).To(Equal(tc.expectedError))
79+
g.Expect(err.Error()).To(Equal(tc.expectedError.Error()))
8080
} else {
8181
g.Expect(err).ToNot(HaveOccurred())
8282
expectedOutput, err := os.ReadFile(tc.expectedOutputFile)
@@ -232,7 +232,7 @@ func TestCreateEC2NodeClassV1FromKopsLaunchTemplateInfo(t *testing.T) {
232232
ec2NodeClass, err := CreateEC2NodeClassV1FromKopsLaunchTemplateInfo(kopsCluster, kmp, kmp.Name, terraformOutputDir)
233233
if tc.expectedError != nil {
234234
g.Expect(err).To(HaveOccurred())
235-
g.Expect(err).To(Equal(tc.expectedError))
235+
g.Expect(err.Error()).To(Equal(tc.expectedError.Error()))
236236
} else {
237237
g.Expect(err).ToNot(HaveOccurred())
238238
g.Expect(err).NotTo(HaveOccurred())

pkg/utils/kops_utils_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package utils
33
import (
44
"bytes"
55
"context"
6-
"errors"
76
"fmt"
87
"io/fs"
98
"os"
@@ -12,6 +11,8 @@ import (
1211
"syscall"
1312
"testing"
1413

14+
"github.com/pkg/errors"
15+
1516
infrastructurev1alpha1 "github.com/topfreegames/kubernetes-kops-operator/apis/infrastructure/v1alpha1"
1617

1718
"github.com/aws/aws-sdk-go-v2/aws"
@@ -495,7 +496,8 @@ func TestGetAmiNameFromImageSource(t *testing.T) {
495496
amiName, amiAccount, err := GetAmiNameFromImageSource(tc.input)
496497
if tc.expectedError != nil {
497498
g.Expect(err).To(HaveOccurred())
498-
g.Expect(err).To(Equal(tc.expectedError))
499+
g.Expect(err.Error()).To(BeEquivalentTo(tc.expectedError.Error()))
500+
499501
} else {
500502
g.Expect(err).To(BeNil())
501503
g.Expect(amiName).To(Equal(tc.output))
@@ -556,7 +558,7 @@ func TestGetUserDataFromTerraformFile(t *testing.T) {
556558
userDataString, err := GetUserDataFromTerraformFile(kopsCluster.Name, kmp.Name, terraformOutputDir)
557559
if tc.expectedError != nil {
558560
g.Expect(err).To(HaveOccurred())
559-
g.Expect(err).To(Equal(tc.expectedError))
561+
g.Expect(err.Error()).To(BeEquivalentTo(tc.expectedError.Error()))
560562
} else {
561563
g.Expect(err).To(BeNil())
562564
g.Expect(userDataString).To(Equal(tc.userData))

0 commit comments

Comments
 (0)