@@ -47,12 +47,14 @@ import (
47
47
otlpresourcev1 "go.opentelemetry.io/proto/otlp/resource/v1"
48
48
otlptracev1 "go.opentelemetry.io/proto/otlp/trace/v1"
49
49
"google.golang.org/protobuf/testing/protocmp"
50
+ "google.golang.org/protobuf/types/known/durationpb"
50
51
"google.golang.org/protobuf/types/known/emptypb"
51
52
52
53
"github.com/gravitational/teleport"
53
54
"github.com/gravitational/teleport/api/client/proto"
54
55
"github.com/gravitational/teleport/api/constants"
55
56
apidefaults "github.com/gravitational/teleport/api/defaults"
57
+ autoupdatev1pb "github.com/gravitational/teleport/api/gen/proto/go/teleport/autoupdate/v1"
56
58
clusterconfigpb "github.com/gravitational/teleport/api/gen/proto/go/teleport/clusterconfig/v1"
57
59
mfav1 "github.com/gravitational/teleport/api/gen/proto/go/teleport/mfa/v1"
58
60
"github.com/gravitational/teleport/api/internalutils/stream"
@@ -61,6 +63,7 @@ import (
61
63
"github.com/gravitational/teleport/api/observability/tracing"
62
64
"github.com/gravitational/teleport/api/trail"
63
65
"github.com/gravitational/teleport/api/types"
66
+ "github.com/gravitational/teleport/api/types/autoupdate"
64
67
"github.com/gravitational/teleport/api/types/installers"
65
68
"github.com/gravitational/teleport/api/utils"
66
69
"github.com/gravitational/teleport/api/utils/keys"
@@ -4611,12 +4614,21 @@ func TestGRPCServer_GetInstallers(t *testing.T) {
4611
4614
tests := []struct {
4612
4615
name string
4613
4616
inputInstallers map [string ]string
4617
+ hasAgentRollout bool
4614
4618
expectedInstallers map [string ]string
4615
4619
}{
4616
4620
{
4617
4621
name : "default installers only" ,
4618
4622
expectedInstallers : map [string ]string {
4619
- types .DefaultInstallerScriptName : installer .DefaultInstaller .GetScript (),
4623
+ types .DefaultInstallerScriptName : installer .LegacyDefaultInstaller .GetScript (),
4624
+ installers .InstallerScriptNameAgentless : installers .DefaultAgentlessInstaller .GetScript (),
4625
+ },
4626
+ },
4627
+ {
4628
+ name : "new default installers" ,
4629
+ hasAgentRollout : true ,
4630
+ expectedInstallers : map [string ]string {
4631
+ types .DefaultInstallerScriptName : installer .NewDefaultInstaller .GetScript (),
4620
4632
installers .InstallerScriptNameAgentless : installers .DefaultAgentlessInstaller .GetScript (),
4621
4633
},
4622
4634
},
@@ -4627,7 +4639,7 @@ func TestGRPCServer_GetInstallers(t *testing.T) {
4627
4639
},
4628
4640
expectedInstallers : map [string ]string {
4629
4641
"my-custom-installer" : "echo test" ,
4630
- types .DefaultInstallerScriptName : installer .DefaultInstaller .GetScript (),
4642
+ types .DefaultInstallerScriptName : installer .LegacyDefaultInstaller .GetScript (),
4631
4643
installers .InstallerScriptNameAgentless : installers .DefaultAgentlessInstaller .GetScript (),
4632
4644
},
4633
4645
},
@@ -4649,6 +4661,25 @@ func TestGRPCServer_GetInstallers(t *testing.T) {
4649
4661
require .NoError (t , err )
4650
4662
})
4651
4663
4664
+ if tc .hasAgentRollout {
4665
+ rollout , err := autoupdate .NewAutoUpdateAgentRollout (
4666
+ & autoupdatev1pb.AutoUpdateAgentRolloutSpec {
4667
+ StartVersion : "1.2.3" ,
4668
+ TargetVersion : "1.2.4" ,
4669
+ Schedule : autoupdate .AgentsScheduleImmediate ,
4670
+ AutoupdateMode : autoupdate .AgentsUpdateModeEnabled ,
4671
+ Strategy : autoupdate .AgentsStrategyTimeBased ,
4672
+ MaintenanceWindowDuration : durationpb .New (1 * time .Hour ),
4673
+ })
4674
+ require .NoError (t , err )
4675
+ _ , err = grpc .AuthServer .CreateAutoUpdateAgentRollout (ctx , rollout )
4676
+ require .NoError (t , err )
4677
+
4678
+ t .Cleanup (func () {
4679
+ assert .NoError (t , grpc .AuthServer .DeleteAutoUpdateAgentRollout (ctx ))
4680
+ })
4681
+ }
4682
+
4652
4683
for name , script := range tc .inputInstallers {
4653
4684
installer , err := types .NewInstallerV1 (name , script )
4654
4685
require .NoError (t , err )
0 commit comments