@@ -20,6 +20,7 @@ import (
20
20
"github.com/elastic/elastic-agent/internal/pkg/agent/application/paths"
21
21
"github.com/elastic/elastic-agent/pkg/core/logger"
22
22
"github.com/elastic/elastic-agent/pkg/core/logger/loggertest"
23
+ "github.com/elastic/elastic-agent/pkg/version"
23
24
mocks "github.com/elastic/elastic-agent/testing/mocks/pkg/control/v2/client"
24
25
)
25
26
@@ -329,6 +330,36 @@ func TestRollback(t *testing.T) {
329
330
}
330
331
}
331
332
333
+ func TestIsRollbackWindowSupported (t * testing.T ) {
334
+ tests := map [string ]struct {
335
+ version string
336
+ want bool
337
+ }{
338
+ "supported_version" : {
339
+ version : "9.2.0-SNAPSHOT" ,
340
+ want : true ,
341
+ },
342
+ "older_version" : {
343
+ version : "9.0.0-SNAPSHOT" ,
344
+ want : false ,
345
+ },
346
+ "exactly_minimum_version" : {
347
+ version : "9.1.0" ,
348
+ want : true ,
349
+ },
350
+ }
351
+
352
+ for name , tt := range tests {
353
+ t .Run (name , func (t * testing.T ) {
354
+ v , err := version .ParseVersion (tt .version )
355
+ require .NoError (t , err )
356
+
357
+ got := isRollbackWindowSupported (v )
358
+ assert .Equal (t , tt .want , got , "isRollbackWindowSupported(%q)" , tt .version )
359
+ })
360
+ }
361
+ }
362
+
332
363
func TestMakeBaseWatchCmd (t * testing.T ) {
333
364
exec , err := os .Executable ()
334
365
require .NoError (t , err )
0 commit comments