mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-07-31 19:18:40 -04:00
fixup! upgrade-agent: allow more than one KubernetesComponent
This commit is contained in:
parent
80808a4741
commit
210090d34c
1 changed files with 51 additions and 4 deletions
|
@ -56,9 +56,38 @@ func TestVersionVerifier(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPrepareUpdate(t *testing.T) {
|
func TestPrepareUpdate(t *testing.T) {
|
||||||
validUpdateRequest := &upgradeproto.ExecuteUpdateRequest{
|
invalidUpgradeRequest := &upgradeproto.ExecuteUpdateRequest{
|
||||||
|
WantedKubernetesVersion: "1337",
|
||||||
|
}
|
||||||
|
slimUpdateRequest := &upgradeproto.ExecuteUpdateRequest{
|
||||||
WantedKubernetesVersion: "v1.1.1",
|
WantedKubernetesVersion: "v1.1.1",
|
||||||
}
|
}
|
||||||
|
oldStyleUpdateRequest := &upgradeproto.ExecuteUpdateRequest{
|
||||||
|
WantedKubernetesVersion: "v1.1.1",
|
||||||
|
KubeadmUrl: "http://example.com/kubeadm",
|
||||||
|
KubeadmHash: "sha256:foo",
|
||||||
|
}
|
||||||
|
newStyleUpdateRequest := &upgradeproto.ExecuteUpdateRequest{
|
||||||
|
WantedKubernetesVersion: "v1.1.1",
|
||||||
|
KubernetesComponents: []*components.Component{
|
||||||
|
{
|
||||||
|
Url: "http://example.com/kubeadm",
|
||||||
|
Hash: "sha256:foo",
|
||||||
|
InstallPath: "/tmp/kubeadm",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
combinedStyleUpdateRequest := &upgradeproto.ExecuteUpdateRequest{
|
||||||
|
WantedKubernetesVersion: "v1.1.1",
|
||||||
|
KubeadmUrl: "http://example.com/kubeadm",
|
||||||
|
KubeadmHash: "sha256:foo",
|
||||||
|
KubernetesComponents: []*components.Component{
|
||||||
|
{
|
||||||
|
Url: "data:application/octet-stream,foo",
|
||||||
|
InstallPath: "/tmp/foo",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
testCases := map[string]struct {
|
testCases := map[string]struct {
|
||||||
installer osInstaller
|
installer osInstaller
|
||||||
updateRequest *upgradeproto.ExecuteUpdateRequest
|
updateRequest *upgradeproto.ExecuteUpdateRequest
|
||||||
|
@ -66,16 +95,34 @@ func TestPrepareUpdate(t *testing.T) {
|
||||||
}{
|
}{
|
||||||
"works": {
|
"works": {
|
||||||
installer: stubOsInstaller{},
|
installer: stubOsInstaller{},
|
||||||
updateRequest: validUpdateRequest,
|
updateRequest: slimUpdateRequest,
|
||||||
},
|
},
|
||||||
"invalid version string": {
|
"invalid version string": {
|
||||||
installer: stubOsInstaller{},
|
installer: stubOsInstaller{},
|
||||||
updateRequest: &upgradeproto.ExecuteUpdateRequest{WantedKubernetesVersion: "1337"},
|
updateRequest: invalidUpgradeRequest,
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
},
|
},
|
||||||
"install error": {
|
"install error": {
|
||||||
installer: stubOsInstaller{InstallErr: fmt.Errorf("install error")},
|
installer: stubOsInstaller{InstallErr: fmt.Errorf("install error")},
|
||||||
updateRequest: validUpdateRequest,
|
updateRequest: oldStyleUpdateRequest,
|
||||||
|
wantErr: true,
|
||||||
|
},
|
||||||
|
"new style works": {
|
||||||
|
installer: stubOsInstaller{},
|
||||||
|
updateRequest: newStyleUpdateRequest,
|
||||||
|
},
|
||||||
|
"new style install error": {
|
||||||
|
installer: stubOsInstaller{InstallErr: fmt.Errorf("install error")},
|
||||||
|
updateRequest: newStyleUpdateRequest,
|
||||||
|
wantErr: true,
|
||||||
|
},
|
||||||
|
"combined style works": {
|
||||||
|
installer: stubOsInstaller{},
|
||||||
|
updateRequest: combinedStyleUpdateRequest,
|
||||||
|
},
|
||||||
|
"combined style install error": {
|
||||||
|
installer: stubOsInstaller{InstallErr: fmt.Errorf("install error")},
|
||||||
|
updateRequest: combinedStyleUpdateRequest,
|
||||||
wantErr: true,
|
wantErr: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue