@@ -10,6 +10,7 @@ import (
10
10
11
11
"github.com/ramendr/ramen/e2e/deployers"
12
12
"github.com/ramendr/ramen/e2e/types"
13
+ "github.com/ramendr/ramen/e2e/util"
13
14
"github.com/ramendr/ramen/e2e/workloads"
14
15
"golang.org/x/sync/errgroup"
15
16
@@ -56,7 +57,9 @@ func newTest(tc types.TestConfig, cmd *Command) *Test {
56
57
57
58
func (t * Test ) Deploy () bool {
58
59
t .startStep ("deploy" )
59
- if err := t .Backend .Deploy (t .Context ); err != nil {
60
+ timedCtx , cancel := t .WithTimeout (util .Timeout )
61
+ defer cancel ()
62
+ if err := t .Backend .Deploy (timedCtx ); err != nil {
60
63
return t .failStep (err )
61
64
}
62
65
console .Pass ("Application %q deployed" , t .Name ())
@@ -65,7 +68,9 @@ func (t *Test) Deploy() bool {
65
68
66
69
func (t * Test ) Undeploy () bool {
67
70
t .startStep ("undeploy" )
68
- if err := t .Backend .Undeploy (t .Context ); err != nil {
71
+ timedCtx , cancel := t .WithTimeout (util .Timeout )
72
+ defer cancel ()
73
+ if err := t .Backend .Undeploy (timedCtx ); err != nil {
69
74
return t .failStep (err )
70
75
}
71
76
console .Pass ("Application %q undeployed" , t .Name ())
@@ -74,7 +79,9 @@ func (t *Test) Undeploy() bool {
74
79
75
80
func (t * Test ) Protect () bool {
76
81
t .startStep ("protect" )
77
- if err := t .Backend .Protect (t .Context ); err != nil {
82
+ timedCtx , cancel := t .WithTimeout (util .Timeout )
83
+ defer cancel ()
84
+ if err := t .Backend .Protect (timedCtx ); err != nil {
78
85
return t .failStep (err )
79
86
}
80
87
console .Pass ("Application %q protected" , t .Name ())
@@ -83,7 +90,9 @@ func (t *Test) Protect() bool {
83
90
84
91
func (t * Test ) Unprotect () bool {
85
92
t .startStep ("unprotect" )
86
- if err := t .Backend .Unprotect (t .Context ); err != nil {
93
+ timedCtx , cancel := t .WithTimeout (util .Timeout )
94
+ defer cancel ()
95
+ if err := t .Backend .Unprotect (timedCtx ); err != nil {
87
96
return t .failStep (err )
88
97
}
89
98
console .Pass ("Application %q unprotected" , t .Name ())
@@ -92,7 +101,9 @@ func (t *Test) Unprotect() bool {
92
101
93
102
func (t * Test ) Failover () bool {
94
103
t .startStep ("failover" )
95
- if err := t .Backend .Failover (t .Context ); err != nil {
104
+ timedCtx , cancel := t .WithTimeout (util .Timeout )
105
+ defer cancel ()
106
+ if err := t .Backend .Failover (timedCtx ); err != nil {
96
107
return t .failStep (err )
97
108
}
98
109
console .Pass ("Application %q failed over" , t .Name ())
@@ -101,7 +112,9 @@ func (t *Test) Failover() bool {
101
112
102
113
func (t * Test ) Relocate () bool {
103
114
t .startStep ("relocate" )
104
- if err := t .Backend .Relocate (t .Context ); err != nil {
115
+ timedCtx , cancel := t .WithTimeout (util .Timeout )
116
+ defer cancel ()
117
+ if err := t .Backend .Relocate (timedCtx ); err != nil {
105
118
return t .failStep (err )
106
119
}
107
120
console .Pass ("Application %q relocated" , t .Name ())
@@ -110,23 +123,26 @@ func (t *Test) Relocate() bool {
110
123
111
124
func (t * Test ) Cleanup () bool {
112
125
var g errgroup.Group
126
+ timedCtx , cancel := t .WithTimeout (util .Timeout )
127
+ defer cancel ()
113
128
114
129
t .startStep ("cleanup" )
115
130
g .Go (func () error {
116
- if err := t .Backend .Unprotect (t . Context ); err != nil {
131
+ if err := t .Backend .Unprotect (timedCtx ); err != nil {
117
132
return err
118
133
}
119
134
return nil
120
135
})
121
136
g .Go (func () error {
122
- if err := t .Backend .Undeploy (t . Context ); err != nil {
137
+ if err := t .Backend .Undeploy (timedCtx ); err != nil {
123
138
return err
124
139
}
125
140
return nil
126
141
})
127
142
if err := g .Wait (); err != nil {
128
143
return t .failStep (err )
129
144
}
145
+
130
146
console .Pass ("Application %q cleaned up" , t .Name ())
131
147
return t .passStep ()
132
148
}
0 commit comments