reflect linter feedback, remove unused argumnents and redundant type from arrays (#2739)

* reflect linter feedback, remove unused argumnents and redundant literal definitions
* add logical backup to TestCreate unit test
This commit is contained in:
Felix Kunde
2024-08-27 17:56:07 +02:00
committed by GitHub
parent a08d1679f2
commit 2ae51fb9ce
10 changed files with 72 additions and 74 deletions
+1 -2
View File
@@ -76,9 +76,8 @@ func (c *Controller) createOperatorCRD(desiredCrd *apiextv1.CustomResourceDefini
context.TODO(), crd.Name, types.MergePatchType, patch, metav1.PatchOptions{}); err != nil {
return fmt.Errorf("could not update customResourceDefinition %q: %v", crd.Name, err)
}
} else {
c.logger.Infof("customResourceDefinition %q has been registered", crd.Name)
}
c.logger.Infof("customResourceDefinition %q is registered", crd.Name)
return wait.PollUntilContextTimeout(context.TODO(), c.config.CRDReadyWaitInterval, c.config.CRDReadyWaitTimeout, false, func(ctx context.Context) (bool, error) {
c, err := c.KubeClient.CustomResourceDefinitions().Get(context.TODO(), desiredCrd.Name, metav1.GetOptions{})
+14 -14
View File
@@ -132,7 +132,7 @@ func TestOldInfrastructureRoleFormat(t *testing.T) {
for _, test := range testTable {
roles, err := utilTestController.getInfrastructureRoles(
[]*config.InfrastructureRole{
&config.InfrastructureRole{
{
SecretName: test.secretName,
UserKey: "user",
PasswordKey: "password",
@@ -163,7 +163,7 @@ func TestNewInfrastructureRoleFormat(t *testing.T) {
// one secret with one configmap
{
[]spec.NamespacedName{
spec.NamespacedName{
{
Namespace: v1.NamespaceDefault,
Name: testInfrastructureRolesNewSecretName,
},
@@ -187,11 +187,11 @@ func TestNewInfrastructureRoleFormat(t *testing.T) {
// multiple standalone secrets
{
[]spec.NamespacedName{
spec.NamespacedName{
{
Namespace: v1.NamespaceDefault,
Name: "infrastructureroles-new-test1",
},
spec.NamespacedName{
{
Namespace: v1.NamespaceDefault,
Name: "infrastructureroles-new-test2",
},
@@ -248,7 +248,7 @@ func TestInfrastructureRoleDefinitions(t *testing.T) {
// only new CRD format
{
[]*config.InfrastructureRole{
&config.InfrastructureRole{
{
SecretName: spec.NamespacedName{
Namespace: v1.NamespaceDefault,
Name: testInfrastructureRolesNewSecretName,
@@ -262,7 +262,7 @@ func TestInfrastructureRoleDefinitions(t *testing.T) {
spec.NamespacedName{},
"",
[]*config.InfrastructureRole{
&config.InfrastructureRole{
{
SecretName: spec.NamespacedName{
Namespace: v1.NamespaceDefault,
Name: testInfrastructureRolesNewSecretName,
@@ -280,7 +280,7 @@ func TestInfrastructureRoleDefinitions(t *testing.T) {
spec.NamespacedName{},
"secretname: infrastructureroles-new-test, userkey: test-user, passwordkey: test-password, rolekey: test-role",
[]*config.InfrastructureRole{
&config.InfrastructureRole{
{
SecretName: spec.NamespacedName{
Namespace: v1.NamespaceDefault,
Name: testInfrastructureRolesNewSecretName,
@@ -298,7 +298,7 @@ func TestInfrastructureRoleDefinitions(t *testing.T) {
spec.NamespacedName{},
"secretname: infrastructureroles-new-test, userkey: test-user, passwordkey: test-password, defaultrolevalue: test-role",
[]*config.InfrastructureRole{
&config.InfrastructureRole{
{
SecretName: spec.NamespacedName{
Namespace: v1.NamespaceDefault,
Name: testInfrastructureRolesNewSecretName,
@@ -319,7 +319,7 @@ func TestInfrastructureRoleDefinitions(t *testing.T) {
},
"",
[]*config.InfrastructureRole{
&config.InfrastructureRole{
{
SecretName: spec.NamespacedName{
Namespace: v1.NamespaceDefault,
Name: testInfrastructureRolesOldSecretName,
@@ -334,7 +334,7 @@ func TestInfrastructureRoleDefinitions(t *testing.T) {
// both formats for CRD
{
[]*config.InfrastructureRole{
&config.InfrastructureRole{
{
SecretName: spec.NamespacedName{
Namespace: v1.NamespaceDefault,
Name: testInfrastructureRolesNewSecretName,
@@ -351,7 +351,7 @@ func TestInfrastructureRoleDefinitions(t *testing.T) {
},
"",
[]*config.InfrastructureRole{
&config.InfrastructureRole{
{
SecretName: spec.NamespacedName{
Namespace: v1.NamespaceDefault,
Name: testInfrastructureRolesNewSecretName,
@@ -361,7 +361,7 @@ func TestInfrastructureRoleDefinitions(t *testing.T) {
RoleKey: "test-role",
Template: false,
},
&config.InfrastructureRole{
{
SecretName: spec.NamespacedName{
Namespace: v1.NamespaceDefault,
Name: testInfrastructureRolesOldSecretName,
@@ -382,7 +382,7 @@ func TestInfrastructureRoleDefinitions(t *testing.T) {
},
"secretname: infrastructureroles-new-test, userkey: test-user, passwordkey: test-password, rolekey: test-role",
[]*config.InfrastructureRole{
&config.InfrastructureRole{
{
SecretName: spec.NamespacedName{
Namespace: v1.NamespaceDefault,
Name: testInfrastructureRolesNewSecretName,
@@ -392,7 +392,7 @@ func TestInfrastructureRoleDefinitions(t *testing.T) {
RoleKey: "test-role",
Template: false,
},
&config.InfrastructureRole{
{
SecretName: spec.NamespacedName{
Namespace: v1.NamespaceDefault,
Name: testInfrastructureRolesOldSecretName,