Skip to content

Commit 15ed9cf

Browse files
committed
fix: separate scaffold
Signed-off-by: ashing <[email protected]>
1 parent 3d3672c commit 15ed9cf

File tree

20 files changed

+314
-826
lines changed

20 files changed

+314
-826
lines changed

cmd/root/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
// to ensure that exec-entrypoint and run can make use of them.
2121

2222
"go.uber.org/zap/zapcore"
23-
"gopkg.in/yaml.v2"
23+
"gopkg.in/yaml.v3"
2424
_ "k8s.io/client-go/plugin/pkg/client/auth"
2525

2626
"github.com/go-logr/zapr"

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ require (
2727
go.uber.org/zap v1.27.0
2828
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
2929
golang.org/x/net v0.28.0
30-
gopkg.in/yaml.v2 v2.4.0
30+
gopkg.in/yaml.v3 v3.0.1
3131
helm.sh/helm/v3 v3.15.4
3232
k8s.io/api v0.31.1
3333
k8s.io/apiextensions-apiserver v0.31.1
@@ -208,7 +208,7 @@ require (
208208
gopkg.in/fsnotify.v1 v1.4.7 // indirect
209209
gopkg.in/inf.v0 v0.9.1 // indirect
210210
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
211-
gopkg.in/yaml.v3 v3.0.1 // indirect
211+
gopkg.in/yaml.v2 v2.4.0 // indirect
212212
k8s.io/apiserver v0.31.1 // indirect
213213
k8s.io/cli-runtime v0.30.3 // indirect
214214
k8s.io/component-base v0.31.1 // indirect

internal/controller/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"text/template"
2222
"time"
2323

24-
"gopkg.in/yaml.v2"
24+
"gopkg.in/yaml.v3"
2525

2626
"github.com/apache/apisix-ingress-controller/internal/types"
2727
)

test/e2e/adminapi/dashboard_api.go

Lines changed: 0 additions & 232 deletions
This file was deleted.

test/e2e/apisix/e2e_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
. "github.com/onsi/gomega"
2121

2222
"github.com/apache/apisix-ingress-controller/test/e2e/framework"
23+
"github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
2324
)
2425

2526
// TestAPISIXE2E runs e2e tests using the APISIX standalone mode
@@ -28,7 +29,10 @@ func TestAPISIXE2E(t *testing.T) {
2829
// init framework
2930
_ = framework.NewFramework()
3031

31-
// TODO: init newDeployer function
32+
// init newDeployer function
33+
scaffold.NewDeployer = func(s *scaffold.Scaffold) scaffold.Deployer {
34+
return scaffold.NewAPISIXDeployer(s)
35+
}
3236

3337
_, _ = fmt.Fprintf(GinkgoWriter, "Starting APISIX standalone e2e suite\n")
3438
RunSpecs(t, "apisix standalone e2e suite")

test/e2e/e2e_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,23 @@ import (
1919
. "github.com/onsi/ginkgo/v2"
2020
. "github.com/onsi/gomega"
2121

22-
_ "github.com/apache/apisix-ingress-controller/test/e2e/adminapi"
2322
_ "github.com/apache/apisix-ingress-controller/test/e2e/crds"
2423
"github.com/apache/apisix-ingress-controller/test/e2e/framework"
2524
_ "github.com/apache/apisix-ingress-controller/test/e2e/gatewayapi"
2625
_ "github.com/apache/apisix-ingress-controller/test/e2e/ingress"
26+
"github.com/apache/apisix-ingress-controller/test/e2e/scaffold"
2727
)
2828

2929
// Run e2e tests using the Ginkgo runner.
3030
func TestE2E(t *testing.T) {
3131
RegisterFailHandler(Fail)
3232
f := framework.NewFramework()
3333

34+
// init newDeployer function
35+
scaffold.NewDeployer = func(s *scaffold.Scaffold) scaffold.Deployer {
36+
return scaffold.NewAPI7Deployer(s)
37+
}
38+
3439
BeforeSuite(f.BeforeSuite)
3540
AfterSuite(f.AfterSuite)
3641

test/e2e/framework/api7_dashboard.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ import (
1616
_ "embed"
1717
"encoding/json"
1818
"fmt"
19-
"github.com/gavv/httpexpect/v2"
2019
"net/http"
2120
"net/url"
2221
"os"
2322
"strings"
2423
"text/template"
2524

25+
"github.com/gavv/httpexpect/v2"
26+
2627
"github.com/google/uuid"
2728
. "github.com/onsi/gomega"
2829

test/e2e/framework/api7_framework.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
. "github.com/onsi/ginkgo/v2" //nolint:staticcheck
1212
. "github.com/onsi/gomega" //nolint:staticcheck
1313
"github.com/stretchr/testify/assert"
14-
"gopkg.in/yaml.v2"
14+
"gopkg.in/yaml.v3"
1515
"helm.sh/helm/v3/pkg/action"
1616
"helm.sh/helm/v3/pkg/chart/loader"
1717
"helm.sh/helm/v3/pkg/cli"
@@ -132,10 +132,15 @@ func (f *Framework) deploy() {
132132
"Tag": dashboardVersion,
133133
})
134134

135+
f.Logf("values: %s", buf.String())
136+
135137
var v map[string]any
136138
err = yaml.Unmarshal(buf.Bytes(), &v)
137139
f.GomegaT.Expect(err).ShouldNot(HaveOccurred(), "unmarshal values")
138140
_, err = install.Run(chart, v)
141+
if err != nil {
142+
f.Logf("install dashboard failed, err: %v", err)
143+
}
139144
f.GomegaT.Expect(err).ShouldNot(HaveOccurred(), "install dashboard")
140145

141146
err = f.ensureService("api7ee3-dashboard", _namespace, 1)

test/e2e/gatewayapi/httproute.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,13 +587,13 @@ spec:
587587
Expect().
588588
Status(200)
589589

590-
s.ScaleIngress(0)
590+
s.Deployer.ScaleIngress(0)
591591

592592
By("delete HTTPRoute httpbin2")
593593
err := s.DeleteResource("HTTPRoute", "httpbin2")
594594
Expect(err).NotTo(HaveOccurred(), "deleting HTTPRoute httpbin2")
595595

596-
s.ScaleIngress(1)
596+
s.Deployer.ScaleIngress(1)
597597
time.Sleep(1 * time.Minute)
598598

599599
s.NewAPISIXClient().

test/e2e/ingress/ingress.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,13 +285,13 @@ spec:
285285
Expect().
286286
Status(200)
287287

288-
s.ScaleIngress(0)
288+
s.Deployer.ScaleIngress(0)
289289

290290
By("delete Ingress")
291291
err = s.DeleteResourceFromString(defaultIngress)
292292
Expect(err).NotTo(HaveOccurred(), "deleting Ingress without IngressClass")
293293

294-
s.ScaleIngress(1)
294+
s.Deployer.ScaleIngress(1)
295295
time.Sleep(1 * time.Minute)
296296

297297
s.NewAPISIXClient().

0 commit comments

Comments
 (0)