File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ import (
2121
2222 "github.com/compose-spec/compose-go/v2/types"
2323 "gotest.tools/v3/assert"
24+
25+ "github.com/docker/compose/v5/pkg/api"
2426)
2527
2628func TestApplyScaleOpt (t * testing.T ) {
@@ -48,3 +50,42 @@ func TestApplyScaleOpt(t *testing.T) {
4850 assert .Equal (t , * bar .Scale , 3 )
4951 assert .Equal (t , * bar .Deploy .Replicas , 3 )
5052}
53+
54+ func TestUpOptions_OnExit (t * testing.T ) {
55+ tests := []struct {
56+ name string
57+ args upOptions
58+ want api.Cascade
59+ }{
60+ {
61+ name : "no cascade" ,
62+ args : upOptions {},
63+ want : api .CascadeIgnore ,
64+ },
65+ {
66+ name : "cascade stop" ,
67+ args : upOptions {cascadeStop : true },
68+ want : api .CascadeStop ,
69+ },
70+ {
71+ name : "cascade fail" ,
72+ args : upOptions {cascadeFail : true },
73+ want : api .CascadeFail ,
74+ },
75+ {
76+ name : "both set - stop takes precedence" ,
77+ args : upOptions {
78+ cascadeStop : true ,
79+ cascadeFail : true ,
80+ },
81+ want : api .CascadeStop ,
82+ },
83+ }
84+
85+ for _ , tt := range tests {
86+ t .Run (tt .name , func (t * testing.T ) {
87+ got := tt .args .OnExit ()
88+ assert .Equal (t , got , tt .want )
89+ })
90+ }
91+ }
You can’t perform that action at this time.
0 commit comments