Skip to content

Commit 880c89e

Browse files
committed
test: stabilize jindo multi-oss e2e follow-up
Signed-off-by: CAICAIIs <3360776475@qq.com>
1 parent 3114a48 commit 880c89e

4 files changed

Lines changed: 443 additions & 25 deletions

File tree

.github/scripts/build-all-images.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ function get_image_tag() {
1010
}
1111

1212
function build_images() {
13+
minio_e2e_img=local/minio-e2e:latest
1314
oss_emulator_img=${IMG_REPO}/oss-emulator:e2e
1415
images=(
1516
${IMG_REPO}/dataset-controller:${IMAGE_TAG}
@@ -25,10 +26,17 @@ function build_images() {
2526
${IMG_REPO}/fluid-csi:${IMAGE_TAG}
2627
${IMG_REPO}/fluid-webhook:${IMAGE_TAG}
2728
${IMG_REPO}/fluid-crd-upgrader:${IMAGE_TAG}
29+
${minio_e2e_img}
2830
${oss_emulator_img}
2931
)
3032

3133
make docker-build-all
34+
tmpdir=$(mktemp -d)
35+
cat > ${tmpdir}/Dockerfile <<'EOF'
36+
FROM minio/minio:latest
37+
EOF
38+
docker build -t ${minio_e2e_img} ${tmpdir}
39+
rm -rf ${tmpdir}
3240
docker build -t ${oss_emulator_img} test/gha-e2e/jindo/oss-emulator
3341

3442
for img in ${images[@]}; do

test/gha-e2e/jindo/minio.yaml

Lines changed: 135 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ spec:
4444
containers:
4545
- name: minio
4646
# Pulls the default Minio image from Docker Hub
47-
image: minio/minio
47+
image: local/minio-e2e:latest
4848
imagePullPolicy: IfNotPresent
4949
resources:
5050
limits:
@@ -68,3 +68,137 @@ spec:
6868
ports:
6969
- containerPort: 9000
7070
automountServiceAccountToken: false
71+
---
72+
apiVersion: v1
73+
kind: Service
74+
metadata:
75+
name: minio-a
76+
labels:
77+
app: minio-a
78+
app.kubernetes.io/part-of: jindo-e2e-minio
79+
spec:
80+
type: ClusterIP
81+
clusterIP: None
82+
ports:
83+
- port: 9000
84+
targetPort: 9000
85+
protocol: TCP
86+
selector:
87+
app: minio-a
88+
app.kubernetes.io/part-of: jindo-e2e-minio
89+
---
90+
apiVersion: apps/v1
91+
kind: Deployment
92+
metadata:
93+
name: minio-a
94+
labels:
95+
app: minio-a
96+
app.kubernetes.io/part-of: jindo-e2e-minio
97+
spec:
98+
replicas: 1
99+
selector:
100+
matchLabels:
101+
app: minio-a
102+
app.kubernetes.io/part-of: jindo-e2e-minio
103+
strategy:
104+
type: Recreate
105+
template:
106+
metadata:
107+
labels:
108+
app: minio-a
109+
app.kubernetes.io/part-of: jindo-e2e-minio
110+
spec:
111+
hostname: bucket-a
112+
subdomain: minio-a
113+
containers:
114+
- name: minio
115+
image: local/minio-e2e:latest
116+
imagePullPolicy: IfNotPresent
117+
resources:
118+
limits:
119+
memory: "512Mi"
120+
args:
121+
- server
122+
- /data
123+
startupProbe:
124+
tcpSocket:
125+
port: 9000
126+
initialDelaySeconds: 1
127+
periodSeconds: 3
128+
env:
129+
- name: MINIO_DOMAIN
130+
value: minio-a.default.svc.cluster.local
131+
- name: MINIO_ROOT_USER
132+
value: "bucketaadmin"
133+
- name: MINIO_ROOT_PASSWORD
134+
value: "bucketasecret"
135+
ports:
136+
- containerPort: 9000
137+
automountServiceAccountToken: false
138+
---
139+
apiVersion: v1
140+
kind: Service
141+
metadata:
142+
name: minio-b
143+
labels:
144+
app: minio-b
145+
app.kubernetes.io/part-of: jindo-e2e-minio
146+
spec:
147+
type: ClusterIP
148+
clusterIP: None
149+
ports:
150+
- port: 9000
151+
targetPort: 9000
152+
protocol: TCP
153+
selector:
154+
app: minio-b
155+
app.kubernetes.io/part-of: jindo-e2e-minio
156+
---
157+
apiVersion: apps/v1
158+
kind: Deployment
159+
metadata:
160+
name: minio-b
161+
labels:
162+
app: minio-b
163+
app.kubernetes.io/part-of: jindo-e2e-minio
164+
spec:
165+
replicas: 1
166+
selector:
167+
matchLabels:
168+
app: minio-b
169+
app.kubernetes.io/part-of: jindo-e2e-minio
170+
strategy:
171+
type: Recreate
172+
template:
173+
metadata:
174+
labels:
175+
app: minio-b
176+
app.kubernetes.io/part-of: jindo-e2e-minio
177+
spec:
178+
hostname: bucket-b
179+
subdomain: minio-b
180+
containers:
181+
- name: minio
182+
image: local/minio-e2e:latest
183+
imagePullPolicy: IfNotPresent
184+
resources:
185+
limits:
186+
memory: "512Mi"
187+
args:
188+
- server
189+
- /data
190+
startupProbe:
191+
tcpSocket:
192+
port: 9000
193+
initialDelaySeconds: 1
194+
periodSeconds: 3
195+
env:
196+
- name: MINIO_DOMAIN
197+
value: minio-b.default.svc.cluster.local
198+
- name: MINIO_ROOT_USER
199+
value: "bucketbadmin"
200+
- name: MINIO_ROOT_PASSWORD
201+
value: "bucketbsecret"
202+
ports:
203+
- containerPort: 9000
204+
automountServiceAccountToken: false

test/gha-e2e/jindo/oss-emulator/main.go

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ func main() {
3535
addr := getenv("LISTEN_ADDR", ":9000")
3636

3737
handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
38+
log.Printf("request method=%s host=%s path=%s rawQuery=%s", r.Method, r.Host, r.URL.Path, r.URL.RawQuery)
39+
3840
if r.URL.Query().Get("location") != "" {
3941
w.Header().Set("Content-Type", "application/xml")
4042
fmt.Fprintf(w, "<LocationConstraint>oss-cn-hangzhou</LocationConstraint>")
@@ -77,21 +79,51 @@ func main() {
7779
http.Error(w, err.Error(), http.StatusInternalServerError)
7880
}
7981
return
80-
}
82+
}
83+
84+
if path == objectKey {
85+
w.Header().Set("Content-Type", "application/octet-stream")
86+
w.Header().Set("Content-Length", fmt.Sprintf("%d", len(objectValue)))
87+
if r.Method == http.MethodGet {
88+
_, _ = w.Write([]byte(objectValue))
89+
}
90+
return
91+
}
8192

82-
if path == objectKey {
83-
w.Header().Set("Content-Type", "application/octet-stream")
84-
w.Header().Set("Content-Length", fmt.Sprintf("%d", len(objectValue)))
85-
if r.Method == http.MethodGet {
86-
_, _ = w.Write([]byte(objectValue))
93+
trimmedObjectDir := strings.TrimSuffix(objectKey, "/")
94+
objectDir := trimmedObjectDir
95+
if idx := strings.LastIndex(trimmedObjectDir, "/"); idx >= 0 {
96+
objectDir = trimmedObjectDir[:idx+1]
8797
}
98+
if path == objectDir || path == strings.TrimSuffix(objectDir, "/") {
99+
if r.Method == http.MethodHead {
100+
w.WriteHeader(http.StatusOK)
101+
return
102+
}
103+
w.Header().Set("Content-Type", "application/xml")
104+
if err := xml.NewEncoder(w).Encode(listBucketResult{
105+
Name: bucketName,
106+
Prefix: objectDir,
107+
MaxKeys: 1000,
108+
IsTrunc: false,
109+
Contents: []objectEntry{{
110+
Key: objectKey,
111+
LastModified: "2026-04-20T00:00:00.000Z",
112+
ETag: "\"dummy-etag\"",
113+
Type: "Normal",
114+
Size: len(objectValue),
115+
StorageClass: "Standard",
116+
}},
117+
}); err != nil {
118+
http.Error(w, err.Error(), http.StatusInternalServerError)
119+
}
120+
return
121+
}
122+
123+
http.NotFound(w, r)
88124
return
89125
}
90126

91-
http.NotFound(w, r)
92-
return
93-
}
94-
95127
http.Error(w, "unsupported method", http.StatusMethodNotAllowed)
96128
})
97129

0 commit comments

Comments
 (0)