Skip to content

Commit 2b7a9c3

Browse files
committed
fix: r
Signed-off-by: ashing <[email protected]>
1 parent cac93b4 commit 2b7a9c3

File tree

6 files changed

+253
-21
lines changed

6 files changed

+253
-21
lines changed

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ require (
152152
github.com/moul/http2curl v1.0.0 // indirect
153153
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
154154
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
155+
github.com/onsi/ginkgo v1.10.1 // indirect
155156
github.com/opencontainers/go-digest v1.0.0 // indirect
156157
github.com/opencontainers/image-spec v1.1.0 // indirect
157158
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect

go.sum

Lines changed: 202 additions & 0 deletions
Large diffs are not rendered by default.

test/e2e/gatewayapi/httproute.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ spec:
881881
return err.Error()
882882
}).WithTimeout(8 * time.Second).ProbeEvery(time.Second).Should(ContainSubstring(`httproutepolicies.apisix.apache.org "http-route-policy-0" not found`))
883883
// access the route without additional vars should be OK
884-
message := retry.DoWithRetry(s.GinkgoT, "", 10, time.Second, func() (string, error) {
884+
message := retry.DoWithRetry(s.GetGinkgoT(), "", 10, time.Second, func() (string, error) {
885885
statusCode := s.NewAPISIXClient().
886886
GET("/get").
887887
WithHost("httpbin.example").
@@ -892,7 +892,7 @@ spec:
892892
}
893893
return "request OK", nil
894894
})
895-
s.Logf(message)
895+
s.GetGinkgoT().Logf(message)
896896
})
897897

898898
It("HTTPRoutePolicy conflicts", func() {
@@ -975,7 +975,7 @@ spec:
975975
err := s.CreateResourceFromString(spec)
976976
Expect(err).NotTo(HaveOccurred(), "creating HTTPRoutePolicy")
977977
// wait for HTTPRoutePolicy is Accepted
978-
framework.HTTPRoutePolicyMustHaveCondition(s.GinkgoT, s.K8sClient, 10*time.Second,
978+
framework.HTTPRoutePolicyMustHaveCondition(s.GetGinkgoT(), s.GetK8sClient(), 10*time.Second,
979979
types.NamespacedName{Namespace: s.Namespace(), Name: "apisix"},
980980
types.NamespacedName{Namespace: s.Namespace(), Name: name},
981981
metav1.Condition{
@@ -984,7 +984,7 @@ spec:
984984
)
985985
}
986986
for _, name := range []string{"http-route-policy-0", "http-route-policy-1", "http-route-policy-2"} {
987-
framework.HTTPRoutePolicyMustHaveCondition(s.GinkgoT, s.K8sClient, 10*time.Second,
987+
framework.HTTPRoutePolicyMustHaveCondition(s.GetGinkgoT(), s.GetK8sClient(), 10*time.Second,
988988
types.NamespacedName{Namespace: s.Namespace(), Name: "apisix"},
989989
types.NamespacedName{Namespace: s.Namespace(), Name: name},
990990
metav1.Condition{
@@ -1008,7 +1008,7 @@ spec:
10081008
err := s.DeleteResource("HTTPRoutePolicy", "http-route-policy-2")
10091009
Expect(err).NotTo(HaveOccurred(), "deleting HTTPRoutePolicy %s", "http-route-policy-2")
10101010
for _, name := range []string{"http-route-policy-0", "http-route-policy-1"} {
1011-
framework.HTTPRoutePolicyMustHaveCondition(s.GinkgoT, s.K8sClient, 10*time.Second,
1011+
framework.HTTPRoutePolicyMustHaveCondition(s.GetGinkgoT(), s.GetK8sClient(), 10*time.Second,
10121012
types.NamespacedName{Namespace: s.Namespace(), Name: "apisix"},
10131013
types.NamespacedName{Namespace: s.Namespace(), Name: name},
10141014
metav1.Condition{
@@ -1029,15 +1029,15 @@ spec:
10291029
By("update HTTPRoutePolicy")
10301030
err = s.CreateResourceFromString(httpRoutePolicy1Priority20)
10311031
Expect(err).NotTo(HaveOccurred(), "update HTTPRoutePolicy's priority to 20")
1032-
framework.HTTPRoutePolicyMustHaveCondition(s.GinkgoT, s.K8sClient, 10*time.Second,
1032+
framework.HTTPRoutePolicyMustHaveCondition(s.GetGinkgoT(), s.GetK8sClient(), 10*time.Second,
10331033
types.NamespacedName{Namespace: s.Namespace(), Name: "apisix"},
10341034
types.NamespacedName{Namespace: s.Namespace(), Name: "http-route-policy-1"},
10351035
metav1.Condition{
10361036
Type: string(v1alpha2.PolicyConditionAccepted),
10371037
},
10381038
)
10391039
for _, name := range []string{"http-route-policy-0", "http-route-policy-1"} {
1040-
framework.HTTPRoutePolicyMustHaveCondition(s.GinkgoT, s.K8sClient, 10*time.Second,
1040+
framework.HTTPRoutePolicyMustHaveCondition(s.GetGinkgoT(), s.GetK8sClient(), 10*time.Second,
10411041
types.NamespacedName{Namespace: s.Namespace(), Name: "apisix"},
10421042
types.NamespacedName{Namespace: s.Namespace(), Name: name},
10431043
metav1.Condition{
@@ -1089,7 +1089,7 @@ spec:
10891089
By("delete the HTTPRoute, assert the HTTPRoutePolicy's status will be changed")
10901090
err := s.DeleteResource("HTTPRoute", "httpbin")
10911091
Expect(err).NotTo(HaveOccurred(), "deleting HTTPRoute")
1092-
message := retry.DoWithRetry(s.GinkgoT, "request the deleted route", 10, time.Second, func() (string, error) {
1092+
message := retry.DoWithRetry(s.GetGinkgoT(), "request the deleted route", 10, time.Second, func() (string, error) {
10931093
statusCode := s.NewAPISIXClient().
10941094
GET("/get").
10951095
WithHost("httpbin.example").
@@ -1102,7 +1102,7 @@ spec:
11021102
}
11031103
return "the route is deleted", nil
11041104
})
1105-
s.Logf(message)
1105+
s.GetGinkgoT().Logf(message)
11061106

11071107
Eventually(func() string {
11081108
spec, err := s.GetResourceYaml("HTTPRoutePolicy", "http-route-policy-0")

test/e2e/scaffold/api7_scaffold.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ type Scaffold struct {
9999
additionalGatewayGroups map[string]*GatewayGroupResources
100100
}
101101

102+
func (s *Scaffold) DeployNginx(options framework.NginxOptions) {
103+
s.Framework.DeployNginx(options)
104+
}
105+
102106
// GatewayGroupResources contains resources associated with a specific Gateway group
103107
type GatewayGroupResources struct {
104108
GatewayGroupID string
@@ -175,8 +179,8 @@ func NewAPI7Scaffold(o *Options) *Scaffold {
175179

176180
// NewDefaultScaffold creates a scaffold with some default options.
177181
// apisix-version default v2
178-
func NewDefaultScaffold() *Scaffold {
179-
return NewAPI7Scaffold(&Options{})
182+
func NewDefaultScaffold() TestScaffold {
183+
return NewScaffold(&Options{})
180184
}
181185

182186
// KillPod kill the pod which name is podName.

test/e2e/scaffold/apisix_scafflod.go

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,6 @@ type APISIXScaffold struct {
5252
httpbinService *corev1.Service
5353
}
5454

55-
func (s *APISIXScaffold) ResourceApplied(resourType, resourceName, resourceRaw string, observedGeneration int) {
56-
//TODO implement me
57-
panic("implement me")
58-
}
59-
60-
func (s *APISIXScaffold) ScaleIngress(i int) {
61-
//TODO implement me
62-
panic("implement me")
63-
}
64-
6555
// NewAPISIXScaffold creates a new APISIX scaffold
6656
func NewAPISIXScaffold(opts *Options) *APISIXScaffold {
6757
if opts == nil {
@@ -402,3 +392,33 @@ func (s *APISIXScaffold) GetK8sClient() client.Client {
402392
//TODO implement me
403393
panic("implement me")
404394
}
395+
396+
func (s *APISIXScaffold) ApplyDefaultGatewayResource(gatewayProxy, gatewayClass, gateway, httpRoute string) {
397+
//TODO implement me
398+
panic("implement me")
399+
}
400+
401+
func (s *APISIXScaffold) DefaultDataplaneResourceHTTPS() dashboard.Cluster {
402+
//TODO implement me
403+
panic("implement me")
404+
}
405+
406+
func (s *APISIXScaffold) ResourceApplied(resourType, resourceName, resourceRaw string, observedGeneration int) {
407+
//TODO implement me
408+
panic("implement me")
409+
}
410+
411+
func (s *APISIXScaffold) ScaleIngress(i int) {
412+
//TODO implement me
413+
panic("implement me")
414+
}
415+
416+
func (s *APISIXScaffold) GetDeploymentLogs(name string) string {
417+
//TODO implement me
418+
panic("implement me")
419+
}
420+
421+
func (s *APISIXScaffold) DeployNginx(options framework.NginxOptions) {
422+
//TODO implement me
423+
panic("implement me")
424+
}

test/e2e/scaffold/interface.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"sigs.k8s.io/controller-runtime/pkg/client"
99

1010
"github.com/apache/apisix-ingress-controller/pkg/dashboard"
11+
"github.com/apache/apisix-ingress-controller/test/e2e/framework"
1112
)
1213

1314
var NewScaffold func(*Options) TestScaffold
@@ -35,13 +36,16 @@ type TestScaffold interface {
3536
GetResourceYaml(resourceType, name string) (string, error)
3637
GetResourceYamlFromNamespace(resourceType, name, namespace string) (string, error)
3738
ResourceApplied(resourType, resourceName, resourceRaw string, observedGeneration int)
39+
ApplyDefaultGatewayResource(gatewayProxy, gatewayClass, gateway, httpRoute string)
40+
GetDeploymentLogs(name string) string
3841

3942
// Kubernetes operation methods
4043
RunKubectlAndGetOutput(args ...string) (string, error)
4144
NewKubeTlsSecret(secretName, cert, key string) error
4245

4346
// Dataplane resource access methods
4447
DefaultDataplaneResource() dashboard.Cluster
48+
DefaultDataplaneResourceHTTPS() dashboard.Cluster
4549

4650
// TODO: remove it
4751
// Gateway group management methods (for multi-gateway support)
@@ -50,4 +54,5 @@ type TestScaffold interface {
5054
NewAPISIXClientForGatewayGroup(gatewayGroupID string) (*httpexpect.Expect, error)
5155

5256
ScaleIngress(int)
57+
DeployNginx(options framework.NginxOptions)
5358
}

0 commit comments

Comments
 (0)