Skip to content

Commit 36a3196

Browse files
authored
fix(ApisixRoute): failed to delete stream_route (#2624)
1 parent 1593285 commit 36a3196

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

internal/adc/translator/apisixroute.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ func (t *Translator) translateStreamRule(tctx *provider.TranslateContext, ar *ap
486486
svc.Name = adc.ComposeServiceNameWithStream(ar.Namespace, ar.Name, part.Name, part.Protocol)
487487
svc.ID = id.GenID(svc.Name)
488488
svc.StreamRoutes = append(svc.StreamRoutes, sr)
489+
svc.Labels = label.GenLabel(ar)
489490

490491
upstream, err := t.translateApisixRouteStreamBackend(tctx, ar, part.Backend)
491492
if err != nil {

test/e2e/crds/v2/streamroute.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package v2
1919

2020
import (
21+
"context"
2122
"fmt"
2223
"time"
2324

@@ -86,6 +87,20 @@ spec:
8687
scaffold.WithExpectedBodyContains("x-my-value"),
8788
},
8889
})
90+
91+
err = s.DeleteResourceFromString(fmt.Sprintf(apisixRoute, s.Namespace()))
92+
Expect(err).ShouldNot(HaveOccurred(), "deleting ApisixRoute")
93+
94+
s.RetryAssertion(func() error {
95+
svcs, err := s.DefaultDataplaneResource().Service().List(context.Background())
96+
if err != nil {
97+
return err
98+
}
99+
if len(svcs) != 0 {
100+
return fmt.Errorf("expected 0 services, got %d", len(svcs))
101+
}
102+
return nil
103+
}).ShouldNot(HaveOccurred(), "waiting for services to be deleted")
89104
})
90105
})
91106

0 commit comments

Comments
 (0)