Skip to content

Commit b16cdef

Browse files
committed
Add test cases for loading .env file
1 parent 7dddd1f commit b16cdef

File tree

5 files changed

+189
-0
lines changed

5 files changed

+189
-0
lines changed

script/test/cmd/tests.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,14 @@ os_output="$KOMPOSE_ROOT/script/test/fixtures/envvars-interpolation/output-os.ya
228228
convert::expect_success_and_warning "$k8s_cmd" "$k8s_output" || exit 1
229229
convert::expect_success_and_warning "$os_cmd" "$os_output" || exit 1
230230

231+
# Test load .env file by default
232+
k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/env-dotenv/compose.yaml convert --stdout --with-kompose-annotation=false"
233+
os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/env-dotenv/compose.yaml convert --stdout --with-kompose-annotation=false"
234+
k8s_output="$KOMPOSE_ROOT/script/test/fixtures/env-dotenv/output-k8s.yaml"
235+
os_output="$KOMPOSE_ROOT/script/test/fixtures/env-dotenv/output-os.yaml"
236+
convert::expect_success_and_warning "$k8s_cmd" "$k8s_output" || exit 1
237+
convert::expect_success_and_warning "$os_cmd" "$os_output" || exit 1
238+
231239
# Test single file output feature
232240
k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/single-file-output/compose.yaml convert --stdout --with-kompose-annotation=false"
233241
k8s_output="$KOMPOSE_ROOT/script/test/fixtures/single-file-output/output-k8s.yaml"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
MINIO_USER=rag_flow
2+
MINIO_PASSWORD=infini_rag_flow
3+
TIMEZONE=Asia/Shanghai
4+
MINIO_PORT=9000
5+
MINIO_CONSOLE_PORT=9001
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: '3'
2+
services:
3+
minio:
4+
image: quay.io/minio/minio:RELEASE.2023-12-20T01-00-02Z
5+
env_file: .env
6+
environment:
7+
- MINIO_ROOT_USER=${MINIO_USER}
8+
- MINIO_ROOT_PASSWORD=${MINIO_PASSWORD}
9+
- TZ=${TIMEZONE}
10+
ports:
11+
- ${MINIO_PORT}:9000
12+
- ${MINIO_CONSOLE_PORT}:9001
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
labels:
6+
io.kompose.service: minio
7+
name: minio
8+
spec:
9+
ports:
10+
- name: "9000"
11+
port: 9000
12+
targetPort: 9000
13+
- name: "9001"
14+
port: 9001
15+
targetPort: 9001
16+
selector:
17+
io.kompose.service: minio
18+
19+
---
20+
apiVersion: apps/v1
21+
kind: Deployment
22+
metadata:
23+
labels:
24+
io.kompose.service: minio
25+
name: minio
26+
spec:
27+
replicas: 1
28+
selector:
29+
matchLabels:
30+
io.kompose.service: minio
31+
template:
32+
metadata:
33+
labels:
34+
io.kompose.service: minio
35+
spec:
36+
containers:
37+
- env:
38+
- name: MINIO_ROOT_PASSWORD
39+
value: infini_rag_flow
40+
- name: MINIO_ROOT_USER
41+
value: rag_flow
42+
- name: TZ
43+
value: Asia/Shanghai
44+
envFrom:
45+
- configMapRef:
46+
name: env
47+
image: quay.io/minio/minio:RELEASE.2023-12-20T01-00-02Z
48+
name: minio
49+
ports:
50+
- containerPort: 9000
51+
protocol: TCP
52+
- containerPort: 9001
53+
protocol: TCP
54+
restartPolicy: Always
55+
56+
---
57+
apiVersion: v1
58+
data:
59+
MINIO_CONSOLE_PORT: "9001"
60+
MINIO_PASSWORD: infini_rag_flow
61+
MINIO_PORT: "9000"
62+
MINIO_USER: rag_flow
63+
TIMEZONE: Asia/Shanghai
64+
kind: ConfigMap
65+
metadata:
66+
labels:
67+
io.kompose.service: minio-env
68+
name: env
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
labels:
6+
io.kompose.service: minio
7+
name: minio
8+
spec:
9+
ports:
10+
- name: "9000"
11+
port: 9000
12+
targetPort: 9000
13+
- name: "9001"
14+
port: 9001
15+
targetPort: 9001
16+
selector:
17+
io.kompose.service: minio
18+
19+
---
20+
apiVersion: v1
21+
data:
22+
MINIO_CONSOLE_PORT: "9001"
23+
MINIO_PASSWORD: infini_rag_flow
24+
MINIO_PORT: "9000"
25+
MINIO_USER: rag_flow
26+
TIMEZONE: Asia/Shanghai
27+
kind: ConfigMap
28+
metadata:
29+
labels:
30+
io.kompose.service: minio-env
31+
name: env
32+
33+
---
34+
apiVersion: apps.openshift.io/v1
35+
kind: DeploymentConfig
36+
metadata:
37+
labels:
38+
io.kompose.service: minio
39+
name: minio
40+
spec:
41+
replicas: 1
42+
selector:
43+
io.kompose.service: minio
44+
template:
45+
metadata:
46+
labels:
47+
io.kompose.service: minio
48+
spec:
49+
containers:
50+
- env:
51+
- name: MINIO_ROOT_PASSWORD
52+
value: infini_rag_flow
53+
- name: MINIO_ROOT_USER
54+
value: rag_flow
55+
- name: TZ
56+
value: Asia/Shanghai
57+
envFrom:
58+
- configMapRef:
59+
name: env
60+
image: ' '
61+
name: minio
62+
ports:
63+
- containerPort: 9000
64+
protocol: TCP
65+
- containerPort: 9001
66+
protocol: TCP
67+
restartPolicy: Always
68+
test: false
69+
triggers:
70+
- type: ConfigChange
71+
- imageChangeParams:
72+
automatic: true
73+
containerNames:
74+
- minio
75+
from:
76+
kind: ImageStreamTag
77+
name: minio:RELEASE.2023-12-20T01-00-02Z
78+
type: ImageChange
79+
80+
---
81+
apiVersion: image.openshift.io/v1
82+
kind: ImageStream
83+
metadata:
84+
labels:
85+
io.kompose.service: minio
86+
name: minio
87+
spec:
88+
lookupPolicy:
89+
local: false
90+
tags:
91+
- from:
92+
kind: DockerImage
93+
name: quay.io/minio/minio:RELEASE.2023-12-20T01-00-02Z
94+
name: RELEASE.2023-12-20T01-00-02Z
95+
referencePolicy:
96+
type: ""

0 commit comments

Comments
 (0)