Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
snorwin committed Jan 22, 2024
1 parent 978060a commit 3ec4b7d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion controllers/instance/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ func (r *Reconciler) generateHAPProxyConfiguration(ctx context.Context, instance

nameKindMap := make(map[string]string)

nameKindMap[instance.Name] = instance.Kind
if err := instance.AddToParser(p); err != nil {
return "", err
}
Expand Down
12 changes: 7 additions & 5 deletions controllers/instance/instance_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,10 @@ var _ = Describe("Reconcile", Label("controller"), func() {
})

It("same resource names error", func() {
proxy.Name = "foo"
backend.Kind = "Backend"
backend.Name = "foo"

Check failure on line 386 in controllers/instance/instance_controller_test.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `gofmt`-ed with `-s` (gofmt)
frontend.Kind = "Frontend"
frontend.Name = "foo"

cli := fake.NewClientBuilder().WithScheme(scheme).WithObjects(initObjs...).WithStatusSubresource(initObjs...).Build()
Expand All @@ -396,11 +398,11 @@ var _ = Describe("Reconcile", Label("controller"), func() {

Ω(cli.Get(ctx, client.ObjectKeyFromObject(proxy), proxy)).ShouldNot(HaveOccurred())
Ω(proxy.Status.Phase).Should(Equal(proxyv1alpha1.InstancePhaseInternalError))
Ω(proxy.Status.Error).Should(Equal("name foo already used by resource of kind Instance"))
Ω(proxy.Status.Error).Should(Equal("name foo already used by resource of kind Frontend"))

frontRes := &configv1alpha1.Frontend{}
Ω(cli.Get(ctx, client.ObjectKey{Namespace: proxy.Namespace, Name: frontend.Name}, frontRes)).ShouldNot(HaveOccurred())
Ω(frontRes.Status.Error).Should(Equal(proxy.Status.Error))
backendRes := &configv1alpha1.Backend{}
Ω(cli.Get(ctx, client.ObjectKey{Namespace: proxy.Namespace, Name: backend.Name}, backendRes)).ShouldNot(HaveOccurred())
Ω(backendRes.Status.Error).Should(Equal(proxy.Status.Error))
})

It("should set status to pending if there is no listens", func() {
Expand Down

0 comments on commit 3ec4b7d

Please sign in to comment.