Skip to content

Commit

Permalink
Adds more info when comparing secrets for cpm integration tests (#6622)
Browse files Browse the repository at this point in the history
  • Loading branch information
plkokanov committed Sep 5, 2022
1 parent d6edd52 commit 6f93f5e
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions test/framework/shootmigrationtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,15 +328,22 @@ func (t *ShootMigrationTest) compareElementsAfterMigration() error {
}
}

differingSecrets := []string{}
var errorMsg string
for name, secret := range t.ComparisonElementsBeforeMigration.SecretsMap {
if !reflect.DeepEqual(secret.Data, t.ComparisonElementsAfterMigration.SecretsMap[name].Data) ||
!reflect.DeepEqual(secret.Labels, t.ComparisonElementsAfterMigration.SecretsMap[name].Labels) {
differingSecrets = append(differingSecrets, name)
if !reflect.DeepEqual(secret.Data, t.ComparisonElementsAfterMigration.SecretsMap[name].Data) {
errorMsg += fmt.Sprintf("Secret %s/%s did not have it's data persisted.\n", secret.Namespace, secret.Name)
}
if !reflect.DeepEqual(secret.Labels, t.ComparisonElementsAfterMigration.SecretsMap[name].Labels) {
errorMsg += fmt.Sprintf("Secret %s/%s did not have it's labels persisted: labels before migration: %v, labels after migration: %v\n",
secret.Namespace,
secret.Name,
secret.Labels,
t.ComparisonElementsAfterMigration.SecretsMap[name].Labels,
)
}
}
if len(differingSecrets) > 0 {
return fmt.Errorf("the following secrets did not have their data or labels persisted during control plane migration: %v", differingSecrets)
if len(errorMsg) > 0 {
return fmt.Errorf("control plane secrets did not have their data or labels persisted during control plane migration:\n %s", errorMsg)
}

return nil
Expand Down

0 comments on commit 6f93f5e

Please sign in to comment.