Skip to content

Commit

Permalink
tests: set AllInstanceGroups alongside InstanceGroups
Browse files Browse the repository at this point in the history
  • Loading branch information
justinsb committed Nov 9, 2024
1 parent 1683894 commit b4306a3
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 23 deletions.
19 changes: 11 additions & 8 deletions pkg/model/awsmodel/autoscalinggroup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ func TestRootVolumeOptimizationFlag(t *testing.T) {
b := AutoscalingGroupModelBuilder{
AWSModelContext: &AWSModelContext{
KopsModelContext: &model.KopsModelContext{
IAMModelContext: iam.IAMModelContext{Cluster: cluster},
SSHPublicKeys: k,
InstanceGroups: igs,
IAMModelContext: iam.IAMModelContext{Cluster: cluster},
SSHPublicKeys: k,
AllInstanceGroups: igs,
InstanceGroups: igs,
},
},
BootstrapScriptBuilder: &model.BootstrapScriptBuilder{
Expand Down Expand Up @@ -177,15 +178,17 @@ func TestAPIServerAdditionalSecurityGroupsWithNLB(t *testing.T) {
b := AutoscalingGroupModelBuilder{
AWSModelContext: &AWSModelContext{
KopsModelContext: &model.KopsModelContext{
IAMModelContext: iam.IAMModelContext{Cluster: cluster},
SSHPublicKeys: [][]byte{[]byte(sshPublicKeyEntry)},
InstanceGroups: igs,
IAMModelContext: iam.IAMModelContext{Cluster: cluster},
SSHPublicKeys: [][]byte{[]byte(sshPublicKeyEntry)},
AllInstanceGroups: igs,
InstanceGroups: igs,
},
},
BootstrapScriptBuilder: &model.BootstrapScriptBuilder{
KopsModelContext: &model.KopsModelContext{
IAMModelContext: iam.IAMModelContext{Cluster: cluster},
InstanceGroups: igs,
IAMModelContext: iam.IAMModelContext{Cluster: cluster},
AllInstanceGroups: igs,
InstanceGroups: igs,
},
Lifecycle: fi.LifecycleSync,
},
Expand Down
5 changes: 3 additions & 2 deletions pkg/model/azuremodel/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ func newTestAzureModelContext() *AzureModelContext {
IAMModelContext: iam.IAMModelContext{
Cluster: cluster,
},
InstanceGroups: []*kops.InstanceGroup{ig},
SSHPublicKeys: [][]byte{[]byte("ssh-rsa ...")},
AllInstanceGroups: []*kops.InstanceGroup{ig},
InstanceGroups: []*kops.InstanceGroup{ig},
SSHPublicKeys: [][]byte{[]byte("ssh-rsa ...")},
},
}
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/model/bootstrapscript_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,9 @@ func TestBootstrapUserData(t *testing.T) {

bs := &BootstrapScriptBuilder{
KopsModelContext: &KopsModelContext{
IAMModelContext: iam.IAMModelContext{Cluster: cluster},
InstanceGroups: []*kops.InstanceGroup{group},
IAMModelContext: iam.IAMModelContext{Cluster: cluster},
AllInstanceGroups: []*kops.InstanceGroup{group},
InstanceGroups: []*kops.InstanceGroup{group},
},
NodeUpConfigBuilder: &nodeupConfigBuilder{cluster: cluster},
NodeUpAssets: map[architectures.Architecture]*assets.MirroredAsset{
Expand Down
5 changes: 3 additions & 2 deletions pkg/model/components/etcdmanager/model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ func LoadKopsModelContext(basedir string) (*model.KopsModelContext, error) {
}

kopsContext := &model.KopsModelContext{
IAMModelContext: iam.IAMModelContext{Cluster: spec.Cluster},
InstanceGroups: spec.InstanceGroups,
IAMModelContext: iam.IAMModelContext{Cluster: spec.Cluster},
AllInstanceGroups: spec.InstanceGroups,
InstanceGroups: spec.InstanceGroups,
}

return kopsContext, nil
Expand Down
5 changes: 3 additions & 2 deletions pkg/model/components/kubeapiserver/model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ func LoadKopsModelContext(basedir string) (*model.KopsModelContext, error) {
}

kopsContext := &model.KopsModelContext{
IAMModelContext: iam.IAMModelContext{Cluster: spec.Cluster},
InstanceGroups: spec.InstanceGroups,
IAMModelContext: iam.IAMModelContext{Cluster: spec.Cluster},
AllInstanceGroups: spec.InstanceGroups,
InstanceGroups: spec.InstanceGroups,
}

return kopsContext, nil
Expand Down
5 changes: 3 additions & 2 deletions pkg/model/components/kubescheduler/model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ func LoadKopsModelContext(basedir string) (*model.KopsModelContext, error) {
}

kopsContext := &model.KopsModelContext{
IAMModelContext: iam.IAMModelContext{Cluster: spec.Cluster},
InstanceGroups: spec.InstanceGroups,
IAMModelContext: iam.IAMModelContext{Cluster: spec.Cluster},
AllInstanceGroups: spec.InstanceGroups,
InstanceGroups: spec.InstanceGroups,
}

for _, u := range spec.AdditionalObjects {
Expand Down
12 changes: 7 additions & 5 deletions pkg/model/openstackmodel/servergroup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1531,9 +1531,10 @@ func createBuilderForCluster(cluster *kops.Cluster, instanceGroups []*kops.Insta
sshPublicKey := []byte("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDF2sghZsClUBXJB4mBMIw8rb0hJWjg1Vz4eUeXwYmTdi92Gf1zNc5xISSip9Y+PWX/jJokPB7tgPnMD/2JOAKhG1bi4ZqB15pYRmbbBekVpM4o4E0dx+czbqjiAm6wlccTrINK5LYenbucAAQt19eH+D0gJwzYUK9SYz1hWnlGS+qurt2bz7rrsG73lN8E2eiNvGtIXqv3GabW/Hea3acOBgCUJQWUDTRu0OmmwxzKbFN/UpNKeRaHlCqwZWjVAsmqA8TX8LIocq7Np7MmIBwt7EpEeZJxThcmC8DEJs9ClAjD+jlLIvMPXKC3JWCPgwCLGxHjy7ckSGFCSzbyPduh")

modelContext := &model.KopsModelContext{
IAMModelContext: iam.IAMModelContext{Cluster: cluster},
InstanceGroups: instanceGroups,
SSHPublicKeys: [][]byte{sshPublicKey},
IAMModelContext: iam.IAMModelContext{Cluster: cluster},
AllInstanceGroups: instanceGroups,
InstanceGroups: instanceGroups,
SSHPublicKeys: [][]byte{sshPublicKey},
}
openstackModelContext := &OpenstackModelContext{
KopsModelContext: modelContext,
Expand Down Expand Up @@ -1569,8 +1570,9 @@ func RunGoldenTest(t *testing.T, basedir string, testCase serverGroupModelBuilde
clusterLifecycle := fi.LifecycleSync
bootstrapScriptBuilder := &model.BootstrapScriptBuilder{
KopsModelContext: &model.KopsModelContext{
IAMModelContext: iam.IAMModelContext{Cluster: testCase.cluster},
InstanceGroups: testCase.instanceGroups,
IAMModelContext: iam.IAMModelContext{Cluster: testCase.cluster},
AllInstanceGroups: testCase.instanceGroups,
InstanceGroups: testCase.instanceGroups,
},
NodeUpConfigBuilder: &nodeupConfigBuilder{},
NodeUpAssets: map[architectures.Architecture]*assets.MirroredAsset{
Expand Down
2 changes: 2 additions & 0 deletions upup/pkg/fi/cloudup/bootstrapchannelbuilder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ func runChannelBuilderTest(t *testing.T, key string, addonManifests []string) {
},
}

kopsModel.AllInstanceGroups = kopsModel.InstanceGroups

tf := &TemplateFunctions{
KopsModelContext: kopsModel,
cloud: cloud,
Expand Down

0 comments on commit b4306a3

Please sign in to comment.