Skip to content

Commit 0e254f4

Browse files
committed
update test
1 parent 5952528 commit 0e254f4

File tree

8 files changed

+25
-22
lines changed

8 files changed

+25
-22
lines changed

internal/provider/api7ee/provider.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,14 +254,13 @@ func (d *api7eeProvider) updateConfigForGatewayProxy(tctx *provider.TranslateCon
254254
return err
255255
}
256256

257-
referrers := tctx.GatewayProxyReferrers[utils.NamespacedName(gp)]
258-
257+
nnk := utils.NamespacedNameKind(gp)
259258
if config == nil {
260-
d.client.ConfigManager.DeleteConfig(referrers...)
259+
d.client.ConfigManager.DeleteConfig(nnk)
261260
return nil
262261
}
263262

264-
d.client.ConfigManager.UpdateConfig(*config, referrers...)
263+
d.client.ConfigManager.UpdateConfig(nnk, *config)
265264
return nil
266265
}
267266

internal/provider/apisix/provider.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,10 @@ func (d *apisixProvider) Start(ctx context.Context) error {
263263
func (d *apisixProvider) sync(ctx context.Context) error {
264264
statusesMap, err := d.client.Sync(ctx)
265265
d.handleADCExecutionErrors(statusesMap)
266-
return err
266+
if err != nil {
267+
return err
268+
}
269+
return nil
267270
}
268271

269272
func (d *apisixProvider) syncNotify() {
@@ -289,14 +292,13 @@ func (d *apisixProvider) updateConfigForGatewayProxy(tctx *provider.TranslateCon
289292
return err
290293
}
291294

292-
referrers := tctx.GatewayProxyReferrers[utils.NamespacedName(gp)]
293-
295+
nnk := utils.NamespacedNameKind(gp)
294296
if config == nil {
295-
d.client.ConfigManager.DeleteConfig(referrers...)
297+
d.client.ConfigManager.DeleteConfig(nnk)
296298
return nil
297299
}
298300

299-
d.client.ConfigManager.UpdateConfig(*config, referrers...)
301+
d.client.ConfigManager.UpdateConfig(nnk, *config)
300302
d.syncNotify()
301303
return nil
302304
}

internal/provider/common/configmanager.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,10 @@ func (s *ConfigManager[K, T]) List() map[K]T {
7171
return configs
7272
}
7373

74-
func (s *ConfigManager[K, T]) UpdateConfig(cfg T, parents ...K) {
74+
func (s *ConfigManager[K, T]) UpdateConfig(key K, cfg T) {
7575
s.mu.Lock()
7676
defer s.mu.Unlock()
77-
for _, parent := range parents {
78-
s.configs[parent] = cfg
79-
}
77+
s.configs[key] = cfg
8078
}
8179

8280
func (s *ConfigManager[K, T]) Update(
@@ -121,10 +119,8 @@ func (s *ConfigManager[K, T]) Delete(key K) {
121119
delete(s.configs, key)
122120
}
123121

124-
func (s *ConfigManager[K, T]) DeleteConfig(keys ...K) {
122+
func (s *ConfigManager[K, T]) DeleteConfig(key K) {
125123
s.mu.Lock()
126124
defer s.mu.Unlock()
127-
for _, key := range keys {
128-
delete(s.configs, key)
129-
}
125+
delete(s.parentRefs, key)
130126
}

test/e2e/crds/v1alpha1/consumer.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package v1alpha1
1919

2020
import (
2121
"fmt"
22+
"os"
2223
"time"
2324

2425
. "github.com/onsi/ginkgo/v2"
@@ -600,7 +601,7 @@ spec:
600601
})
601602

602603
It("Should sync Consumer during startup", func() {
603-
if s.Deployer.Name() == framework.ProviderTypeAPI7EE {
604+
if os.Getenv("PROVIDER_TYPE") == framework.ProviderTypeAPI7EE {
604605
Skip("skipping test in API7EE mode")
605606
}
606607
Expect(s.CreateResourceFromString(consumer2)).NotTo(HaveOccurred(), "creating unused consumer")

test/e2e/crds/v1alpha1/gatewayproxy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ spec:
160160
})
161161

162162
Context("Test GatewayProxy update configs", func() {
163-
FIt("scaling apisix pods to test that the controller watches endpoints", func() {
163+
It("scaling apisix pods to test that the controller watches endpoints", func() {
164164
if s.Deployer.Name() == framework.ProviderTypeAPI7EE {
165165
Skip("this case only for apisix/apisix-standalone mode")
166166
}

test/e2e/crds/v2/status.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ spec:
155155
})
156156
})
157157

158-
FIt("dataplane unavailable", func() {
158+
It("dataplane unavailable", func() {
159159
if os.Getenv("PROVIDER_TYPE") != framework.ProviderTypeAPISIXStandalone {
160160
Skip("skip for api7ee mode because it use dashboard admin api")
161161
}

test/e2e/gatewayapi/status.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ spec:
110110
_ = s.DeleteResource("Gateway", "apisix")
111111
})
112112

113-
FIt("dataplane unavailable", func() {
114-
if os.Getenv("PROVIDER_TYPE") != framework.ProviderTypeAPI7EE {
113+
It("dataplane unavailable", func() {
114+
if os.Getenv("PROVIDER_TYPE") == framework.ProviderTypeAPI7EE {
115115
Skip("skip for api7ee mode because it use dashboard admin api")
116116
}
117117
By("Create HTTPRoute")

test/e2e/scaffold/apisix_deployer.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ func (s *APISIXDeployer) BeforeEach() {
109109
e.Wait()
110110
}
111111

112+
var skip = true
113+
112114
func (s *APISIXDeployer) AfterEach() {
113115
if CurrentSpecReport().Failed() {
114116
if os.Getenv("TEST_ENV") == "CI" {
@@ -122,6 +124,9 @@ func (s *APISIXDeployer) AfterEach() {
122124
_, _ = fmt.Fprintln(GinkgoWriter, output)
123125
}
124126
}
127+
if skip {
128+
return
129+
}
125130

126131
// Delete all additional gateways
127132
for identifier := range s.additionalGateways {

0 commit comments

Comments
 (0)