Skip to content

Commit 9a29eb2

Browse files
AlinsRanCopilot
andcommitted
fix: stabilize adc e2e retries
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent eef1a88 commit 9a29eb2

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,12 @@ $(ADC_BIN):
421421
ifeq ($(ADC_VERSION),dev)
422422
@echo "ADC_VERSION=dev, skip download"
423423
else
424-
curl -sSfL https://github.com/api7/adc/releases/download/v${ADC_VERSION}/adc_${ADC_VERSION}_${GOOS}_${GOARCH}.tar.gz \
425-
| tar -xz -C $(LOCALBIN)
424+
tmp_archive=$$(mktemp); \
425+
trap 'rm -f "$$tmp_archive"' EXIT; \
426+
curl --retry 5 --retry-delay 2 --retry-connrefused -sSfL \
427+
-o "$$tmp_archive" \
428+
https://github.com/api7/adc/releases/download/v${ADC_VERSION}/adc_${ADC_VERSION}_${GOOS}_${GOARCH}.tar.gz; \
429+
tar -xzf "$$tmp_archive" -C $(LOCALBIN)
426430
endif
427431

428432
gofmt: ## Apply go fmt

test/e2e/webhook/apisixconsumer.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package webhook
1919

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

2425
. "github.com/onsi/ginkgo/v2"
@@ -92,6 +93,8 @@ stringData:
9293
Skip("ADC validation requires apisix-standalone backend")
9394
}
9495

96+
privateKeyYAML := " " + strings.ReplaceAll(framework.TestKey, "\n", "\n ")
97+
9598
firstConsumer := fmt.Sprintf(`
9699
apiVersion: apisix.apache.org/v2
97100
kind: ApisixConsumer
@@ -123,7 +126,9 @@ spec:
123126
value:
124127
key: consumer-b-key
125128
algorithm: INVALID_ALGO
126-
`, s.Namespace(), s.Namespace())
129+
private_key: |
130+
%s
131+
`, s.Namespace(), s.Namespace(), privateKeyYAML)
127132

128133
By("creating ApisixConsumer with an invalid jwt-auth algorithm")
129134
err = s.CreateResourceFromString(invalidConsumer)
@@ -141,9 +146,10 @@ spec:
141146
jwtAuth:
142147
value:
143148
key: consumer-b-key
144-
algorithm: HS256
145-
secret: consumer-b-secret
146-
`, s.Namespace(), s.Namespace())
149+
algorithm: RS256
150+
private_key: |
151+
%s
152+
`, s.Namespace(), s.Namespace(), privateKeyYAML)
147153

148154
By("creating corrected ApisixConsumer with a valid algorithm")
149155
err = s.CreateResourceFromString(correctedConsumer)

0 commit comments

Comments
 (0)