Skip to content

Commit

Permalink
test: add functional tests for loading env_file
Browse files Browse the repository at this point in the history
Signed-off-by: AhmedGrati <ahmedgrati1999@gmail.com>
  • Loading branch information
TessaIO committed Jul 23, 2023
1 parent f184d48 commit 7bb69be
Show file tree
Hide file tree
Showing 40 changed files with 521 additions and 28 deletions.
6 changes: 6 additions & 0 deletions script/test/cmd/tests_new.sh
Original file line number Diff line number Diff line change
Expand Up @@ -295,3 +295,9 @@ convert::expect_success "$k8s_cmd" "$k8s_output"
convert::expect_success "$os_cmd" "$os_output"

# Test env_file support
k8s_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/env/docker-compose.yml convert --stdout --with-kompose-annotation=false"
k8s_output="$KOMPOSE_ROOT/script/test/fixtures/env/output-k8s.yaml"
os_cmd="kompose -f $KOMPOSE_ROOT/script/test/fixtures/env/docker-compose.yml convert --provider openshift --stdout --with-kompose-annotation=false"
os_output="$KOMPOSE_ROOT/script/test/fixtures/env/output-os.yaml"
convert::expect_success "$k8s_cmd" "$k8s_output"
convert::expect_success "$os_cmd" "$os_output"
2 changes: 2 additions & 0 deletions script/test/cmd/update-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ $KOMPOSE_ROOT/kompose -f $KOMPOSE_ROOT/script/test/fixtures/host-port-protocol/d
$KOMPOSE_ROOT/kompose -f $KOMPOSE_ROOT/script/test/fixtures/external-traffic-policy/docker-compose-v1.yaml convert --stdout --with-kompose-annotation=false > $KOMPOSE_ROOT/script/test/fixtures/external-traffic-policy/output-k8s-v1.yaml
$KOMPOSE_ROOT/kompose -f $KOMPOSE_ROOT/script/test/fixtures/external-traffic-policy/docker-compose-v2.yaml convert --stdout --with-kompose-annotation=false > $KOMPOSE_ROOT/script/test/fixtures/external-traffic-policy/output-k8s-v2.yaml
$KOMPOSE_ROOT/kompose -f $KOMPOSE_ROOT/script/test/fixtures/compose-file-support/compose.yaml convert --stdout --with-kompose-annotation=false > $KOMPOSE_ROOT/script/test/fixtures/compose-file-support/output-k8s.yaml
$KOMPOSE_ROOT/kompose -f $KOMPOSE_ROOT/script/test/fixtures/env/docker-compose.yml convert --stdout --with-kompose-annotation=false > $KOMPOSE_ROOT/script/test/fixtures/env/output-k8s.yaml
fi

if $UPDATE_OS ; then
Expand All @@ -48,4 +49,5 @@ $KOMPOSE_ROOT/kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtur
$KOMPOSE_ROOT/kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/host-port-protocol/docker-compose.yaml convert --stdout --with-kompose-annotation=false > $KOMPOSE_ROOT/script/test/fixtures/host-port-protocol/output-os.yaml
$KOMPOSE_ROOT/kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/external-traffic-policy/docker-compose-v1.yaml convert --stdout --with-kompose-annotation=false > $KOMPOSE_ROOT/script/test/fixtures/external-traffic-policy/output-os-v1.yaml
$KOMPOSE_ROOT/kompose --provider=openshift -f $KOMPOSE_ROOT/script/test/fixtures/external-traffic-policy/docker-compose-v2.yaml convert --stdout --with-kompose-annotation=false > $KOMPOSE_ROOT/script/test/fixtures/external-traffic-policy/output-os-v2.yaml
$KOMPOSE_ROOT/kompose -f $KOMPOSE_ROOT/script/test/fixtures/env/docker-compose.yml convert --stdout --with-kompose-annotation=false --provider openshift > $KOMPOSE_ROOT/script/test/fixtures/env/output-os.yaml
fi
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
labels:
io.kompose.service: redis
name: redis
namespace: default
spec:
clusterIP: None
ports:
Expand All @@ -27,6 +28,7 @@ metadata:
labels:
io.kompose.service: web
name: web
namespace: default
spec:
ports:
- name: "5000"
Expand All @@ -47,6 +49,7 @@ metadata:
labels:
io.kompose.service: redis
name: redis
namespace: default
spec:
replicas: 1
selector:
Expand Down Expand Up @@ -77,6 +80,7 @@ metadata:
labels:
io.kompose.service: web
name: web
namespace: default
spec:
replicas: 1
selector:
Expand Down
4 changes: 4 additions & 0 deletions script/test/fixtures/change-in-volume/output-k8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
labels:
io.kompose.service: redis
name: redis
namespace: default
spec:
clusterIP: None
ports:
Expand All @@ -27,6 +28,7 @@ metadata:
labels:
io.kompose.service: web
name: web
namespace: default
spec:
ports:
- name: "5000"
Expand All @@ -47,6 +49,7 @@ metadata:
labels:
io.kompose.service: redis
name: redis
namespace: default
spec:
replicas: 1
selector:
Expand Down Expand Up @@ -77,6 +80,7 @@ metadata:
labels:
io.kompose.service: web
name: web
namespace: default
spec:
replicas: 1
selector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
labels:
io.kompose.service: redis
name: redis
namespace: default
spec:
clusterIP: None
ports:
Expand All @@ -27,6 +28,7 @@ metadata:
labels:
io.kompose.service: web
name: web
namespace: default
spec:
ports:
- name: "5000"
Expand All @@ -47,6 +49,7 @@ metadata:
labels:
io.kompose.service: redis
name: redis
namespace: default
spec:
replicas: 1
selector:
Expand Down Expand Up @@ -92,6 +95,7 @@ metadata:
labels:
io.kompose.service: redis
name: redis
namespace: default
spec:
lookupPolicy:
local: false
Expand All @@ -116,6 +120,7 @@ metadata:
labels:
io.kompose.service: web
name: web
namespace: default
spec:
replicas: 1
selector:
Expand Down Expand Up @@ -175,6 +180,7 @@ metadata:
labels:
io.kompose.service: web
name: web
namespace: default
spec:
lookupPolicy:
local: false
Expand Down
6 changes: 6 additions & 0 deletions script/test/fixtures/change-in-volume/output-os.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
labels:
io.kompose.service: redis
name: redis
namespace: default
spec:
clusterIP: None
ports:
Expand All @@ -27,6 +28,7 @@ metadata:
labels:
io.kompose.service: web
name: web
namespace: default
spec:
ports:
- name: "5000"
Expand All @@ -47,6 +49,7 @@ metadata:
labels:
io.kompose.service: redis
name: redis
namespace: default
spec:
replicas: 1
selector:
Expand Down Expand Up @@ -92,6 +95,7 @@ metadata:
labels:
io.kompose.service: redis
name: redis
namespace: default
spec:
lookupPolicy:
local: false
Expand All @@ -116,6 +120,7 @@ metadata:
labels:
io.kompose.service: web
name: web
namespace: default
spec:
replicas: 1
selector:
Expand Down Expand Up @@ -175,6 +180,7 @@ metadata:
labels:
io.kompose.service: web
name: web
namespace: default
spec:
lookupPolicy:
local: false
Expand Down
2 changes: 2 additions & 0 deletions script/test/fixtures/compose-file-support/output-k8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
labels:
io.kompose.service: web
name: web
namespace: default
spec:
ports:
- name: "80"
Expand All @@ -24,6 +25,7 @@ metadata:
labels:
io.kompose.service: web
name: web
namespace: default
spec:
replicas: 1
selector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
labels:
io.kompose.service: db
name: db
namespace: default
spec:
replicas: 1
selector:
Expand Down Expand Up @@ -54,6 +55,7 @@ metadata:
labels:
io.kompose.service: db
name: db-cm0
namespace: default

---
apiVersion: apps/v1
Expand All @@ -65,6 +67,7 @@ metadata:
labels:
io.kompose.service: web
name: web
namespace: default
spec:
replicas: 1
selector:
Expand Down Expand Up @@ -115,6 +118,7 @@ metadata:
labels:
io.kompose.service: web
name: web-cm0
namespace: default

---
apiVersion: v1
Expand All @@ -128,4 +132,5 @@ metadata:
labels:
io.kompose.service: web
name: web-cm1
namespace: default

5 changes: 5 additions & 0 deletions script/test/fixtures/configmap-volume/output-k8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
labels:
io.kompose.service: db
name: db
namespace: default
spec:
replicas: 1
selector:
Expand Down Expand Up @@ -50,6 +51,7 @@ metadata:
labels:
io.kompose.service: db
name: db-cm0
namespace: default

---
apiVersion: apps/v1
Expand All @@ -59,6 +61,7 @@ metadata:
labels:
io.kompose.service: web
name: web
namespace: default
spec:
replicas: 1
selector:
Expand Down Expand Up @@ -107,6 +110,7 @@ metadata:
labels:
io.kompose.service: web
name: web-cm0
namespace: default

---
apiVersion: v1
Expand All @@ -120,4 +124,5 @@ metadata:
labels:
io.kompose.service: web
name: web-cm1
namespace: default

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
labels:
io.kompose.service: db
name: db
namespace: default
spec:
replicas: 1
selector:
Expand Down Expand Up @@ -65,6 +66,7 @@ metadata:
labels:
io.kompose.service: db
name: db
namespace: default
spec:
lookupPolicy:
local: false
Expand Down Expand Up @@ -93,6 +95,7 @@ metadata:
labels:
io.kompose.service: db
name: db-cm0
namespace: default

---
apiVersion: apps.openshift.io/v1
Expand All @@ -104,6 +107,7 @@ metadata:
labels:
io.kompose.service: web
name: web
namespace: default
spec:
replicas: 1
selector:
Expand Down Expand Up @@ -166,6 +170,7 @@ metadata:
labels:
io.kompose.service: web
name: web
namespace: default
spec:
lookupPolicy:
local: false
Expand Down Expand Up @@ -193,6 +198,7 @@ metadata:
labels:
io.kompose.service: web
name: web-cm0
namespace: default

---
apiVersion: v1
Expand All @@ -206,4 +212,5 @@ metadata:
labels:
io.kompose.service: web
name: web-cm1
namespace: default

7 changes: 7 additions & 0 deletions script/test/fixtures/configmap-volume/output-os.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
labels:
io.kompose.service: db
name: db
namespace: default
spec:
replicas: 1
selector:
Expand Down Expand Up @@ -63,6 +64,7 @@ metadata:
labels:
io.kompose.service: db
name: db
namespace: default
spec:
lookupPolicy:
local: false
Expand Down Expand Up @@ -91,6 +93,7 @@ metadata:
labels:
io.kompose.service: db
name: db-cm0
namespace: default

---
apiVersion: apps.openshift.io/v1
Expand All @@ -100,6 +103,7 @@ metadata:
labels:
io.kompose.service: web
name: web
namespace: default
spec:
replicas: 1
selector:
Expand Down Expand Up @@ -162,6 +166,7 @@ metadata:
labels:
io.kompose.service: web
name: web
namespace: default
spec:
lookupPolicy:
local: false
Expand Down Expand Up @@ -189,6 +194,7 @@ metadata:
labels:
io.kompose.service: web
name: web-cm0
namespace: default

---
apiVersion: v1
Expand All @@ -202,4 +208,5 @@ metadata:
labels:
io.kompose.service: web
name: web-cm1
namespace: default

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
labels:
io.kompose.service: redis
name: redis
namespace: default
spec:
ports:
- name: "6379"
Expand All @@ -24,6 +25,7 @@ metadata:
labels:
io.kompose.service: redis
name: redis
namespace: default
spec:
replicas: 1
selector:
Expand Down
Loading

0 comments on commit 7bb69be

Please sign in to comment.