mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-07-27 17:25:20 -04:00
Ref/want err from err expected (#82)
consistent naming for test values using 'want' instead of 'expect/ed'
This commit is contained in:
parent
6265b307af
commit
51068abc27
91 changed files with 2319 additions and 2319 deletions
|
@ -15,13 +15,13 @@ func TestSecrets(t *testing.T) {
|
|||
testCases := map[string]struct {
|
||||
instance core.Instance
|
||||
cloudServiceAccountURI string
|
||||
expectedSecrets resources.Secrets
|
||||
expectErr bool
|
||||
wantSecrets resources.Secrets
|
||||
wantErr bool
|
||||
}{
|
||||
"Secrets works": {
|
||||
instance: core.Instance{ProviderID: "azure:///subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachines/instance-name"},
|
||||
cloudServiceAccountURI: "serviceaccount://azure?tenant_id=tenant-id&client_id=client-id&client_secret=client-secret&location=location",
|
||||
expectedSecrets: resources.Secrets{
|
||||
wantSecrets: resources.Secrets{
|
||||
&k8s.Secret{
|
||||
TypeMeta: meta.TypeMeta{
|
||||
Kind: "Secret",
|
||||
|
@ -40,7 +40,7 @@ func TestSecrets(t *testing.T) {
|
|||
"Secrets works for scale sets": {
|
||||
instance: core.Instance{ProviderID: "azure:///subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-name/virtualMachines/instance-id"},
|
||||
cloudServiceAccountURI: "serviceaccount://azure?tenant_id=tenant-id&client_id=client-id&client_secret=client-secret&location=location",
|
||||
expectedSecrets: resources.Secrets{
|
||||
wantSecrets: resources.Secrets{
|
||||
&k8s.Secret{
|
||||
TypeMeta: meta.TypeMeta{
|
||||
Kind: "Secret",
|
||||
|
@ -57,13 +57,13 @@ func TestSecrets(t *testing.T) {
|
|||
},
|
||||
},
|
||||
"invalid providerID fails": {
|
||||
instance: core.Instance{ProviderID: "invalid"},
|
||||
expectErr: true,
|
||||
instance: core.Instance{ProviderID: "invalid"},
|
||||
wantErr: true,
|
||||
},
|
||||
"invalid cloudServiceAccountURI fails": {
|
||||
instance: core.Instance{ProviderID: "azure:///subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachines/instance-name"},
|
||||
cloudServiceAccountURI: "invalid",
|
||||
expectErr: true,
|
||||
wantErr: true,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -74,12 +74,12 @@ func TestSecrets(t *testing.T) {
|
|||
|
||||
cloud := CloudControllerManager{}
|
||||
secrets, err := cloud.Secrets(tc.instance, tc.cloudServiceAccountURI)
|
||||
if tc.expectErr {
|
||||
if tc.wantErr {
|
||||
assert.Error(err)
|
||||
return
|
||||
}
|
||||
require.NoError(err)
|
||||
assert.Equal(tc.expectedSecrets, secrets)
|
||||
assert.Equal(tc.wantSecrets, secrets)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue