Skip to content

Commit e06480b

Browse files
committed
fix: add ci
Signed-off-by: ashing <[email protected]>
1 parent 6136d77 commit e06480b

File tree

5 files changed

+83
-14
lines changed

5 files changed

+83
-14
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: APISIX E2E Test
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- release-v2-dev
8+
pull_request:
9+
branches:
10+
- master
11+
- release-v2-dev
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
prepare:
19+
name: Prepare
20+
runs-on: buildjet-2vcpu-ubuntu-2204
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Setup Go Env
26+
id: go
27+
uses: actions/setup-go@v4
28+
with:
29+
go-version: "1.22"
30+
31+
- name: Install kind
32+
run: |
33+
go install sigs.k8s.io/[email protected]
34+
35+
e2e-test:
36+
needs:
37+
- prepare
38+
runs-on: buildjet-2vcpu-ubuntu-2204
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v4
42+
with:
43+
submodules: recursive
44+
45+
- name: Setup Go Env
46+
uses: actions/setup-go@v4
47+
with:
48+
go-version: "1.22"
49+
50+
- name: Build images
51+
env:
52+
TAG: dev
53+
ARCH: amd64
54+
ENABLE_PROXY: "false"
55+
BASE_IMAGE_TAG: "debug"
56+
run: |
57+
echo "building images..."
58+
make build-image
59+
60+
- name: Launch Kind Cluster
61+
run: |
62+
make kind-up
63+
64+
- name: Install Gateway API And CRDs
65+
run: |
66+
make install
67+
68+
- name: Run E2E test suite
69+
shell: bash
70+
run: |
71+
make e2e-test-standalone

test/e2e/framework/api7_dashboard.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"text/template"
2424

2525
"github.com/gavv/httpexpect/v2"
26-
2726
"github.com/google/uuid"
2827
. "github.com/onsi/gomega"
2928

test/e2e/framework/api7_framework.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"time"
99

1010
"github.com/api7/gopkg/pkg/log"
11+
"github.com/gruntwork-io/terratest/modules/k8s"
1112
. "github.com/onsi/ginkgo/v2" //nolint:staticcheck
1213
. "github.com/onsi/gomega" //nolint:staticcheck
1314
"github.com/stretchr/testify/assert"
@@ -16,8 +17,6 @@ import (
1617
"helm.sh/helm/v3/pkg/chart/loader"
1718
"helm.sh/helm/v3/pkg/cli"
1819
"helm.sh/helm/v3/pkg/kube"
19-
20-
"github.com/gruntwork-io/terratest/modules/k8s"
2120
k8serrors "k8s.io/apimachinery/pkg/api/errors"
2221
)
2322

test/e2e/framework/k8s.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
"github.com/gavv/httpexpect/v2"
2929
"github.com/gruntwork-io/terratest/modules/k8s"
3030
"github.com/gruntwork-io/terratest/modules/testing"
31-
"github.com/onsi/gomega"
3231
. "github.com/onsi/gomega" //nolint:staticcheck
3332
"go.uber.org/zap"
3433
corev1 "k8s.io/api/core/v1"
@@ -272,7 +271,7 @@ func waitExponentialBackoff(condFunc func() (bool, error)) error {
272271

273272
func (f *Framework) NewExpectResponse(httpBody any) *httpexpect.Response {
274273
body, err := json.Marshal(httpBody)
275-
f.GomegaT.Expect(err).ShouldNot(gomega.HaveOccurred())
274+
f.GomegaT.Expect(err).ShouldNot(HaveOccurred())
276275

277276
return httpexpect.NewResponse(f.GinkgoT, &http.Response{
278277
Header: http.Header{
@@ -287,15 +286,15 @@ func (f *Framework) ListPods(selector string) []corev1.Pod {
287286
pods, err := f.clientset.CoreV1().Pods(_namespace).List(context.TODO(), metav1.ListOptions{
288287
LabelSelector: selector,
289288
})
290-
f.GomegaT.Expect(err).ShouldNot(gomega.HaveOccurred(), "list pod: ", selector)
289+
f.GomegaT.Expect(err).ShouldNot(HaveOccurred(), "list pod: ", selector)
291290
return pods.Items
292291
}
293292

294293
func (f *Framework) ListRunningPods(selector string) []corev1.Pod {
295294
pods, err := f.clientset.CoreV1().Pods(_namespace).List(context.TODO(), metav1.ListOptions{
296295
LabelSelector: selector,
297296
})
298-
f.GomegaT.Expect(err).ShouldNot(gomega.HaveOccurred(), "list pod: ", selector)
297+
f.GomegaT.Expect(err).ShouldNot(HaveOccurred(), "list pod: ", selector)
299298
runningPods := make([]corev1.Pod, 0)
300299
for _, p := range pods.Items {
301300
if p.Status.Phase == corev1.PodRunning && p.DeletionTimestamp == nil {
@@ -324,7 +323,7 @@ func (f *Framework) ExecCommandInPod(podName string, cmd ...string) (string, str
324323

325324
var stdout, stderr bytes.Buffer
326325
exec, err := remotecommand.NewSPDYExecutor(f.restConfig, "POST", req.URL())
327-
f.GomegaT.Expect(err).ShouldNot(gomega.HaveOccurred(), "request kubernetes exec api")
326+
f.GomegaT.Expect(err).ShouldNot(HaveOccurred(), "request kubernetes exec api")
328327
_ = exec.StreamWithContext(context.TODO(), remotecommand.StreamOptions{
329328
Stdin: nil,
330329
Stdout: &stdout,
@@ -338,13 +337,13 @@ func (f *Framework) GetPodLogs(name string, previous bool) string {
338337
Pods(_namespace).
339338
GetLogs(name, &corev1.PodLogOptions{Previous: previous}).
340339
Stream(context.Background())
341-
f.GomegaT.Expect(err).ShouldNot(gomega.HaveOccurred(), "get logs")
340+
f.GomegaT.Expect(err).ShouldNot(HaveOccurred(), "get logs")
342341
defer func() {
343342
_ = reader.Close()
344343
}()
345344

346345
logs, err := io.ReadAll(reader)
347-
f.GomegaT.Expect(err).ShouldNot(gomega.HaveOccurred(), "read all logs")
346+
f.GomegaT.Expect(err).ShouldNot(HaveOccurred(), "read all logs")
348347

349348
return string(logs)
350349
}
@@ -367,7 +366,7 @@ func (f *Framework) WaitPodsLog(selector, keyword string, sinceSeconds int64, ti
367366
opts.TailLines = ptr.To(int64(0))
368367
}
369368
logStream, err := f.clientset.CoreV1().Pods(p.Namespace).GetLogs(p.Name, &opts).Stream(context.Background())
370-
f.GomegaT.Expect(err).Should(gomega.BeNil())
369+
f.GomegaT.Expect(err).Should(BeNil())
371370
scanner := bufio.NewScanner(logStream)
372371
scanner.Split(bufio.ScanLines)
373372
for scanner.Scan() {

test/e2e/scaffold/apisix_deployer.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ import (
66
"os"
77
"time"
88

9-
"github.com/apache/apisix-ingress-controller/pkg/utils"
10-
"github.com/apache/apisix-ingress-controller/test/e2e/framework"
119
"github.com/gruntwork-io/terratest/modules/k8s"
1210
. "github.com/onsi/ginkgo/v2" //nolint:staticcheck
1311
. "github.com/onsi/gomega" //nolint:staticcheck
14-
1512
corev1 "k8s.io/api/core/v1"
1613
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
14+
15+
"github.com/apache/apisix-ingress-controller/pkg/utils"
16+
"github.com/apache/apisix-ingress-controller/test/e2e/framework"
1717
)
1818

1919
type APISIXDeployOptions struct {
@@ -199,6 +199,7 @@ func getEnvOrDefault(key, defaultValue string) string {
199199
return defaultValue
200200
}
201201

202+
//nolint:unused
202203
func (s *APISIXDeployer) createAdminTunnel(
203204
svc *corev1.Service,
204205
kubectlOpts *k8s.KubectlOptions,

0 commit comments

Comments
 (0)