mirror of
https://github.com/1Password/onepassword-operator.git
synced 2025-10-23 16:00:46 +00:00
Fix tests and add new test
This commit is contained in:
@@ -329,6 +329,7 @@ var tests = []testReconcileItem{
|
|||||||
op.VersionAnnotation: "456",
|
op.VersionAnnotation: "456",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Type: corev1.SecretTypeOpaque,
|
||||||
Data: expectedSecretData,
|
Data: expectedSecretData,
|
||||||
},
|
},
|
||||||
expectedError: nil,
|
expectedError: nil,
|
||||||
@@ -340,6 +341,7 @@ var tests = []testReconcileItem{
|
|||||||
op.VersionAnnotation: fmt.Sprint(version),
|
op.VersionAnnotation: fmt.Sprint(version),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Type: corev1.SecretTypeOpaque,
|
||||||
Data: expectedSecretData,
|
Data: expectedSecretData,
|
||||||
},
|
},
|
||||||
opItem: map[string]string{
|
opItem: map[string]string{
|
||||||
@@ -373,6 +375,7 @@ var tests = []testReconcileItem{
|
|||||||
op.VersionAnnotation: fmt.Sprint(version),
|
op.VersionAnnotation: fmt.Sprint(version),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Type: corev1.SecretTypeOpaque,
|
||||||
Data: expectedSecretData,
|
Data: expectedSecretData,
|
||||||
},
|
},
|
||||||
opItem: map[string]string{
|
opItem: map[string]string{
|
||||||
|
@@ -185,6 +185,60 @@ var tests = []testReconcileItem{
|
|||||||
},
|
},
|
||||||
Labels: map[string]string{},
|
Labels: map[string]string{},
|
||||||
},
|
},
|
||||||
|
Type: corev1.SecretTypeOpaque,
|
||||||
|
Data: expectedSecretData,
|
||||||
|
},
|
||||||
|
opItem: map[string]string{
|
||||||
|
userKey: username,
|
||||||
|
passKey: password,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
testName: "Test Updating Type of Existing Kubernetes Secret using OnePasswordItem",
|
||||||
|
customResource: &onepasswordv1.OnePasswordItem{
|
||||||
|
TypeMeta: metav1.TypeMeta{
|
||||||
|
Kind: onePasswordItemKind,
|
||||||
|
APIVersion: onePasswordItemAPIVersion,
|
||||||
|
},
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: name,
|
||||||
|
Namespace: namespace,
|
||||||
|
Annotations: map[string]string{
|
||||||
|
op.VersionAnnotation: fmt.Sprint(version),
|
||||||
|
op.ItemPathAnnotation: itemPath,
|
||||||
|
},
|
||||||
|
Labels: map[string]string{},
|
||||||
|
},
|
||||||
|
Spec: onepasswordv1.OnePasswordItemSpec{
|
||||||
|
ItemPath: itemPath,
|
||||||
|
},
|
||||||
|
Type: string(corev1.SecretTypeBasicAuth),
|
||||||
|
},
|
||||||
|
existingSecret: &corev1.Secret{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: name,
|
||||||
|
Namespace: namespace,
|
||||||
|
Annotations: map[string]string{
|
||||||
|
op.VersionAnnotation: fmt.Sprint(version),
|
||||||
|
op.ItemPathAnnotation: itemPath,
|
||||||
|
},
|
||||||
|
Labels: map[string]string{},
|
||||||
|
},
|
||||||
|
Type: corev1.SecretTypeOpaque,
|
||||||
|
Data: expectedSecretData,
|
||||||
|
},
|
||||||
|
expectedError: nil,
|
||||||
|
expectedResultSecret: &corev1.Secret{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: name,
|
||||||
|
Namespace: namespace,
|
||||||
|
Annotations: map[string]string{
|
||||||
|
op.VersionAnnotation: fmt.Sprint(version),
|
||||||
|
op.ItemPathAnnotation: itemPath,
|
||||||
|
},
|
||||||
|
Labels: map[string]string{},
|
||||||
|
},
|
||||||
|
Type: corev1.SecretTypeBasicAuth,
|
||||||
Data: expectedSecretData,
|
Data: expectedSecretData,
|
||||||
},
|
},
|
||||||
opItem: map[string]string{
|
opItem: map[string]string{
|
||||||
@@ -206,6 +260,7 @@ var tests = []testReconcileItem{
|
|||||||
Spec: onepasswordv1.OnePasswordItemSpec{
|
Spec: onepasswordv1.OnePasswordItemSpec{
|
||||||
ItemPath: itemPath,
|
ItemPath: itemPath,
|
||||||
},
|
},
|
||||||
|
Type: "custom",
|
||||||
},
|
},
|
||||||
existingSecret: nil,
|
existingSecret: nil,
|
||||||
expectedError: nil,
|
expectedError: nil,
|
||||||
@@ -217,6 +272,7 @@ var tests = []testReconcileItem{
|
|||||||
op.VersionAnnotation: fmt.Sprint(version),
|
op.VersionAnnotation: fmt.Sprint(version),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Type: corev1.SecretType("custom"),
|
||||||
Data: expectedSecretData,
|
Data: expectedSecretData,
|
||||||
},
|
},
|
||||||
opItem: map[string]string{
|
opItem: map[string]string{
|
||||||
@@ -249,6 +305,7 @@ var tests = []testReconcileItem{
|
|||||||
op.VersionAnnotation: fmt.Sprint(version),
|
op.VersionAnnotation: fmt.Sprint(version),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Type: corev1.SecretTypeOpaque,
|
||||||
Data: expectedSecretData,
|
Data: expectedSecretData,
|
||||||
},
|
},
|
||||||
opItem: map[string]string{
|
opItem: map[string]string{
|
||||||
@@ -281,6 +338,7 @@ var tests = []testReconcileItem{
|
|||||||
op.VersionAnnotation: fmt.Sprint(version),
|
op.VersionAnnotation: fmt.Sprint(version),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Type: corev1.SecretTypeOpaque,
|
||||||
Data: map[string][]byte{
|
Data: map[string][]byte{
|
||||||
"password": []byte(password),
|
"password": []byte(password),
|
||||||
"username": []byte(username),
|
"username": []byte(username),
|
||||||
@@ -322,6 +380,7 @@ var tests = []testReconcileItem{
|
|||||||
op.VersionAnnotation: fmt.Sprint(version),
|
op.VersionAnnotation: fmt.Sprint(version),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Type: corev1.SecretTypeOpaque,
|
||||||
Data: map[string][]byte{
|
Data: map[string][]byte{
|
||||||
"password": []byte(password),
|
"password": []byte(password),
|
||||||
"username": []byte(username),
|
"username": []byte(username),
|
||||||
|
Reference in New Issue
Block a user