azure_secret.go 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. limitations under the License.
  10. */
  11. package azure
  12. import (
  13. // nolint
  14. . "github.com/onsi/ginkgo/v2"
  15. "github.com/external-secrets/external-secrets-e2e/framework"
  16. "github.com/external-secrets/external-secrets-e2e/suites/provider/cases/common"
  17. esapi "github.com/external-secrets/external-secrets/apis/externalsecrets/v1"
  18. )
  19. const (
  20. withStaticCredentials = "with static credentials"
  21. withReferentAuth = "with referent auth"
  22. )
  23. // keyvault type=secret should behave just like any other secret store.
  24. var _ = Describe("[azure]", Label("azure", "keyvault", "secret"), func() {
  25. f := framework.New("eso-azure")
  26. prov := newFromEnv(f)
  27. DescribeTable("sync secrets", framework.TableFuncWithExternalSecret(f, prov),
  28. framework.Compose(withStaticCredentials, f, common.SimpleDataSync, useStaticCredentials),
  29. framework.Compose(withStaticCredentials, f, common.NestedJSONWithGJSON, useStaticCredentials),
  30. framework.Compose(withStaticCredentials, f, common.JSONDataFromSync, useStaticCredentials),
  31. framework.Compose(withStaticCredentials, f, common.JSONDataFromRewrite, useStaticCredentials),
  32. framework.Compose(withStaticCredentials, f, common.JSONDataWithProperty, useStaticCredentials),
  33. framework.Compose(withStaticCredentials, f, common.JSONDataWithTemplate, useStaticCredentials),
  34. framework.Compose(withStaticCredentials, f, common.DockerJSONConfig, useStaticCredentials),
  35. framework.Compose(withStaticCredentials, f, common.DataPropertyDockerconfigJSON, useStaticCredentials),
  36. framework.Compose(withStaticCredentials, f, common.SSHKeySync, useStaticCredentials),
  37. framework.Compose(withStaticCredentials, f, common.SSHKeySyncDataProperty, useStaticCredentials),
  38. framework.Compose(withStaticCredentials, f, common.SyncWithoutTargetName, useStaticCredentials),
  39. framework.Compose(withStaticCredentials, f, common.JSONDataWithoutTargetName, useStaticCredentials),
  40. framework.Compose(withStaticCredentials, f, common.SimpleDataSync, useReferentAuth),
  41. )
  42. })
  43. func useStaticCredentials(tc *framework.TestCase) {
  44. tc.ExternalSecret.Spec.SecretStoreRef.Name = tc.Framework.Namespace.Name
  45. }
  46. func useReferentAuth(tc *framework.TestCase) {
  47. tc.ExternalSecret.Spec.SecretStoreRef.Name = referentAuthName(tc.Framework)
  48. tc.ExternalSecret.Spec.SecretStoreRef.Kind = esapi.ClusterSecretStoreKind
  49. }