Skip to content

Commit

Permalink
chore: rebase main
Browse files Browse the repository at this point in the history
  • Loading branch information
sophon-zt committed Oct 16, 2023
1 parent 6ed038c commit aef2704
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions internal/testutil/apps/cluster_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,14 @@ func (factory *MockClusterFactory) AddUserSecretVolume(name, mountPoint, resName
SecretName: resName,
},
}
comps := factory.Get().Spec.ComponentSpecs
if len(comps) > 0 {
userResourcesRefs := comps[len(comps)-1].UserResourceRefs
return factory.lastComponentRef(func(comp *appsv1alpha1.ClusterComponentSpec) {
userResourcesRefs := comp.UserResourceRefs
if userResourcesRefs == nil {
userResourcesRefs = &appsv1alpha1.UserResourceRefs{}
comps[len(comps)-1].UserResourceRefs = userResourcesRefs
comp.UserResourceRefs = userResourcesRefs
}
userResourcesRefs.SecretRefs = append(userResourcesRefs.SecretRefs, secretResource)
}
factory.Get().Spec.ComponentSpecs = comps
return factory
})
}

func (factory *MockClusterFactory) AddUserConfigmapVolume(name, mountPoint, resName, containerName string) *MockClusterFactory {
Expand All @@ -218,15 +215,12 @@ func (factory *MockClusterFactory) AddUserConfigmapVolume(name, mountPoint, resN
},
},
}
comps := factory.Get().Spec.ComponentSpecs
if len(comps) > 0 {
userResourcesRefs := comps[len(comps)-1].UserResourceRefs
return factory.lastComponentRef(func(comp *appsv1alpha1.ClusterComponentSpec) {
userResourcesRefs := comp.UserResourceRefs
if userResourcesRefs == nil {
userResourcesRefs = &appsv1alpha1.UserResourceRefs{}
comps[len(comps)-1].UserResourceRefs = userResourcesRefs
comp.UserResourceRefs = userResourcesRefs
}
userResourcesRefs.ConfigMapRefs = append(userResourcesRefs.ConfigMapRefs, cmResource)
}
factory.Get().Spec.ComponentSpecs = comps
return factory
})
}

0 comments on commit aef2704

Please sign in to comment.