forked from LaconicNetwork/kompose
Add test cases for loading .env file
This commit is contained in:
parent
7dddd1f0e8
commit
b16cdef598
@ -228,6 +228,14 @@ os_output="$KOMPOSE_ROOT/script/test/fixtures/envvars-interpolation/output-os.ya
|
||||
convert::expect_success_and_warning "$k8s_cmd" "$k8s_output" || exit 1
|
||||
convert::expect_success_and_warning "$os_cmd" "$os_output" || exit 1
|
||||
|
||||
# Test load .env file by default
|
||||
k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/env-dotenv/compose.yaml convert --stdout --with-kompose-annotation=false"
|
||||
os_cmd="kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/env-dotenv/compose.yaml convert --stdout --with-kompose-annotation=false"
|
||||
k8s_output="$KOMPOSE_ROOT/script/test/fixtures/env-dotenv/output-k8s.yaml"
|
||||
os_output="$KOMPOSE_ROOT/script/test/fixtures/env-dotenv/output-os.yaml"
|
||||
convert::expect_success_and_warning "$k8s_cmd" "$k8s_output" || exit 1
|
||||
convert::expect_success_and_warning "$os_cmd" "$os_output" || exit 1
|
||||
|
||||
# Test single file output feature
|
||||
k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/single-file-output/compose.yaml convert --stdout --with-kompose-annotation=false"
|
||||
k8s_output="$KOMPOSE_ROOT/script/test/fixtures/single-file-output/output-k8s.yaml"
|
||||
|
||||
5
script/test/fixtures/env-dotenv/.env
vendored
Normal file
5
script/test/fixtures/env-dotenv/.env
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
MINIO_USER=rag_flow
|
||||
MINIO_PASSWORD=infini_rag_flow
|
||||
TIMEZONE=Asia/Shanghai
|
||||
MINIO_PORT=9000
|
||||
MINIO_CONSOLE_PORT=9001
|
||||
12
script/test/fixtures/env-dotenv/compose.yaml
vendored
Normal file
12
script/test/fixtures/env-dotenv/compose.yaml
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
version: '3'
|
||||
services:
|
||||
minio:
|
||||
image: quay.io/minio/minio:RELEASE.2023-12-20T01-00-02Z
|
||||
env_file: .env
|
||||
environment:
|
||||
- MINIO_ROOT_USER=${MINIO_USER}
|
||||
- MINIO_ROOT_PASSWORD=${MINIO_PASSWORD}
|
||||
- TZ=${TIMEZONE}
|
||||
ports:
|
||||
- ${MINIO_PORT}:9000
|
||||
- ${MINIO_CONSOLE_PORT}:9001
|
||||
68
script/test/fixtures/env-dotenv/output-k8s.yaml
vendored
Normal file
68
script/test/fixtures/env-dotenv/output-k8s.yaml
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
io.kompose.service: minio
|
||||
name: minio
|
||||
spec:
|
||||
ports:
|
||||
- name: "9000"
|
||||
port: 9000
|
||||
targetPort: 9000
|
||||
- name: "9001"
|
||||
port: 9001
|
||||
targetPort: 9001
|
||||
selector:
|
||||
io.kompose.service: minio
|
||||
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
io.kompose.service: minio
|
||||
name: minio
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
io.kompose.service: minio
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
io.kompose.service: minio
|
||||
spec:
|
||||
containers:
|
||||
- env:
|
||||
- name: MINIO_ROOT_PASSWORD
|
||||
value: infini_rag_flow
|
||||
- name: MINIO_ROOT_USER
|
||||
value: rag_flow
|
||||
- name: TZ
|
||||
value: Asia/Shanghai
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: env
|
||||
image: quay.io/minio/minio:RELEASE.2023-12-20T01-00-02Z
|
||||
name: minio
|
||||
ports:
|
||||
- containerPort: 9000
|
||||
protocol: TCP
|
||||
- containerPort: 9001
|
||||
protocol: TCP
|
||||
restartPolicy: Always
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
MINIO_CONSOLE_PORT: "9001"
|
||||
MINIO_PASSWORD: infini_rag_flow
|
||||
MINIO_PORT: "9000"
|
||||
MINIO_USER: rag_flow
|
||||
TIMEZONE: Asia/Shanghai
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
labels:
|
||||
io.kompose.service: minio-env
|
||||
name: env
|
||||
96
script/test/fixtures/env-dotenv/output-os.yaml
vendored
Normal file
96
script/test/fixtures/env-dotenv/output-os.yaml
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
io.kompose.service: minio
|
||||
name: minio
|
||||
spec:
|
||||
ports:
|
||||
- name: "9000"
|
||||
port: 9000
|
||||
targetPort: 9000
|
||||
- name: "9001"
|
||||
port: 9001
|
||||
targetPort: 9001
|
||||
selector:
|
||||
io.kompose.service: minio
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
MINIO_CONSOLE_PORT: "9001"
|
||||
MINIO_PASSWORD: infini_rag_flow
|
||||
MINIO_PORT: "9000"
|
||||
MINIO_USER: rag_flow
|
||||
TIMEZONE: Asia/Shanghai
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
labels:
|
||||
io.kompose.service: minio-env
|
||||
name: env
|
||||
|
||||
---
|
||||
apiVersion: apps.openshift.io/v1
|
||||
kind: DeploymentConfig
|
||||
metadata:
|
||||
labels:
|
||||
io.kompose.service: minio
|
||||
name: minio
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
io.kompose.service: minio
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
io.kompose.service: minio
|
||||
spec:
|
||||
containers:
|
||||
- env:
|
||||
- name: MINIO_ROOT_PASSWORD
|
||||
value: infini_rag_flow
|
||||
- name: MINIO_ROOT_USER
|
||||
value: rag_flow
|
||||
- name: TZ
|
||||
value: Asia/Shanghai
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: env
|
||||
image: ' '
|
||||
name: minio
|
||||
ports:
|
||||
- containerPort: 9000
|
||||
protocol: TCP
|
||||
- containerPort: 9001
|
||||
protocol: TCP
|
||||
restartPolicy: Always
|
||||
test: false
|
||||
triggers:
|
||||
- type: ConfigChange
|
||||
- imageChangeParams:
|
||||
automatic: true
|
||||
containerNames:
|
||||
- minio
|
||||
from:
|
||||
kind: ImageStreamTag
|
||||
name: minio:RELEASE.2023-12-20T01-00-02Z
|
||||
type: ImageChange
|
||||
|
||||
---
|
||||
apiVersion: image.openshift.io/v1
|
||||
kind: ImageStream
|
||||
metadata:
|
||||
labels:
|
||||
io.kompose.service: minio
|
||||
name: minio
|
||||
spec:
|
||||
lookupPolicy:
|
||||
local: false
|
||||
tags:
|
||||
- from:
|
||||
kind: DockerImage
|
||||
name: quay.io/minio/minio:RELEASE.2023-12-20T01-00-02Z
|
||||
name: RELEASE.2023-12-20T01-00-02Z
|
||||
referencePolicy:
|
||||
type: ""
|
||||
Loading…
Reference in New Issue
Block a user