Fix tests

This commit is contained in:
Marton Soos
2021-09-03 15:42:02 +03:00
parent 2c4b4df01a
commit e365ebfdfa
2 changed files with 5 additions and 5 deletions

View File

@@ -232,7 +232,7 @@ var tests = []testReconcileItem{
expectedError: nil, expectedError: nil,
expectedResultSecret: &corev1.Secret{ expectedResultSecret: &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "my-secret-it3m", Name: "my-sECReT-it3m",
Namespace: namespace, Namespace: namespace,
Annotations: map[string]string{ Annotations: map[string]string{
op.VersionAnnotation: fmt.Sprint(version), op.VersionAnnotation: fmt.Sprint(version),
@@ -264,7 +264,7 @@ var tests = []testReconcileItem{
expectedError: nil, expectedError: nil,
expectedResultSecret: &corev1.Secret{ expectedResultSecret: &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "my-secret-it3m", Name: "my-sECReT-it3m",
Namespace: namespace, Namespace: namespace,
Annotations: map[string]string{ Annotations: map[string]string{
op.VersionAnnotation: fmt.Sprint(version), op.VersionAnnotation: fmt.Sprint(version),
@@ -274,7 +274,7 @@ var tests = []testReconcileItem{
"password": []byte(password), "password": []byte(password),
"username": []byte(username), "username": []byte(username),
"first-host": []byte(firstHost), "first-host": []byte(firstHost),
"aws-access-key": []byte(awsKey), "AWS-Access-Key": []byte(awsKey),
"ice-cream-type": []byte(iceCream), "ice-cream-type": []byte(iceCream),
}, },
}, },

View File

@@ -102,7 +102,7 @@ func TestBuildKubernetesSecretFromOnePasswordItem(t *testing.T) {
item.Fields = generateFields(5) item.Fields = generateFields(5)
kubeSecret := BuildKubernetesSecretFromOnePasswordItem(name, namespace, annotations, item) kubeSecret := BuildKubernetesSecretFromOnePasswordItem(name, namespace, annotations, item)
if kubeSecret.Name != strings.ToLower(name) { if kubeSecret.Name != name {
t.Errorf("Expected name value: %v but got: %v", name, kubeSecret.Name) t.Errorf("Expected name value: %v but got: %v", name, kubeSecret.Name)
} }
if kubeSecret.Namespace != namespace { if kubeSecret.Namespace != namespace {
@@ -116,7 +116,7 @@ func TestBuildKubernetesSecretFromOnePasswordItem(t *testing.T) {
func TestBuildKubernetesSecretFixesInvalidLabels(t *testing.T) { func TestBuildKubernetesSecretFixesInvalidLabels(t *testing.T) {
name := "inV@l1d k8s secret%name" name := "inV@l1d k8s secret%name"
expectedName := "inv-l1d-k8s-secret-name" expectedName := "inV-l1d-k8s-secret-name"
namespace := "someNamespace" namespace := "someNamespace"
annotations := map[string]string{ annotations := map[string]string{
"annotationKey": "annotationValue", "annotationKey": "annotationValue",