mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-08-03 04:26:20 -04:00
ref: pre v2.15 cleanup (#2871)
This commit is contained in:
parent
3799525103
commit
489e07677e
12 changed files with 35 additions and 215 deletions
|
@ -131,20 +131,8 @@ func prepareUpdate(ctx context.Context, installer osInstaller, updateRequest *up
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var cs components.Components
|
||||
if len(updateRequest.KubeadmUrl) > 0 {
|
||||
cs = append(cs, &components.Component{
|
||||
Url: updateRequest.KubeadmUrl,
|
||||
Hash: updateRequest.KubeadmHash,
|
||||
InstallPath: constants.KubeadmPath,
|
||||
Extract: false,
|
||||
})
|
||||
}
|
||||
cs = append(cs, updateRequest.KubernetesComponents...)
|
||||
|
||||
// Download & install the Kubernetes components.
|
||||
for _, c := range cs {
|
||||
for _, c := range updateRequest.KubernetesComponents {
|
||||
if err := installer.Install(ctx, c); err != nil {
|
||||
return fmt.Errorf("installing Kubernetes component %q: %w", c.Url, err)
|
||||
}
|
||||
|
|
|
@ -62,12 +62,7 @@ func TestPrepareUpdate(t *testing.T) {
|
|||
slimUpdateRequest := &upgradeproto.ExecuteUpdateRequest{
|
||||
WantedKubernetesVersion: "v1.1.1",
|
||||
}
|
||||
oldStyleUpdateRequest := &upgradeproto.ExecuteUpdateRequest{
|
||||
WantedKubernetesVersion: "v1.1.1",
|
||||
KubeadmUrl: "http://example.com/kubeadm",
|
||||
KubeadmHash: "sha256:foo",
|
||||
}
|
||||
newStyleUpdateRequest := &upgradeproto.ExecuteUpdateRequest{
|
||||
updateRequest := &upgradeproto.ExecuteUpdateRequest{
|
||||
WantedKubernetesVersion: "v1.1.1",
|
||||
KubernetesComponents: []*components.Component{
|
||||
{
|
||||
|
@ -79,8 +74,6 @@ func TestPrepareUpdate(t *testing.T) {
|
|||
}
|
||||
combinedStyleUpdateRequest := &upgradeproto.ExecuteUpdateRequest{
|
||||
WantedKubernetesVersion: "v1.1.1",
|
||||
KubeadmUrl: "http://example.com/kubeadm",
|
||||
KubeadmHash: "sha256:foo",
|
||||
KubernetesComponents: []*components.Component{
|
||||
{
|
||||
Url: "data:application/octet-stream,foo",
|
||||
|
@ -104,16 +97,16 @@ func TestPrepareUpdate(t *testing.T) {
|
|||
},
|
||||
"install error": {
|
||||
installer: stubOsInstaller{InstallErr: fmt.Errorf("install error")},
|
||||
updateRequest: oldStyleUpdateRequest,
|
||||
updateRequest: updateRequest,
|
||||
wantErr: true,
|
||||
},
|
||||
"new style works": {
|
||||
installer: stubOsInstaller{},
|
||||
updateRequest: newStyleUpdateRequest,
|
||||
updateRequest: updateRequest,
|
||||
},
|
||||
"new style install error": {
|
||||
installer: stubOsInstaller{InstallErr: fmt.Errorf("install error")},
|
||||
updateRequest: newStyleUpdateRequest,
|
||||
updateRequest: updateRequest,
|
||||
wantErr: true,
|
||||
},
|
||||
"combined style works": {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue