Skip to content

Commit

Permalink
checks valid error message in test
Browse files Browse the repository at this point in the history
  • Loading branch information
Disper committed Jul 5, 2024
1 parent f59fe33 commit eb9672e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ var _ = Describe("Gardener Cluster controller", func() {

return newGardenerCluster.Status.State == imv1.ErrorState &&
len(newGardenerCluster.Status.Conditions) > 0 &&
newGardenerCluster.Status.Conditions[0].Reason == string(imv1.ConditionReasonFailedToGetKubeconfig)
newGardenerCluster.Status.Conditions[0].Reason == string(imv1.ConditionReasonFailedToGetKubeconfig) &&
newGardenerCluster.Status.Conditions[0].Message == "Failed to get kubeconfig. Error: this could be context deadline exceeded"
}, time.Second*30, time.Second*3).Should(BeTrue())

By("Metrics should contain error label")
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/kubeconfig/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ var _ = BeforeSuite(func() {
func setupKubeconfigProviderMock(kpMock *kubeconfig_mocks.KubeconfigProvider) {
kpMock.On("Fetch", anyContext, "shootName1").Return("kubeconfig1", nil)
kpMock.On("Fetch", anyContext, "shootName2").Return("kubeconfig2", nil)
kpMock.On("Fetch", anyContext, "shootName3").Return("", errors.New("failed to get kubeconfig"))
kpMock.On("Fetch", anyContext, "shootName3").Return("", errors.New("this could be context deadline exceeded"))
kpMock.On("Fetch", anyContext, "shootName6").Return("kubeconfig6", nil)
kpMock.On("Fetch", anyContext, "shootName4").Return("kubeconfig4", nil)
kpMock.On("Fetch", anyContext, "shootName5").Return("kubeconfig5", nil)
Expand Down

0 comments on commit eb9672e

Please sign in to comment.