fixtures_test.go 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /*
  2. Copyright © The ESO Authors
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. https://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package beyondtrustworkloadcredentialsdynamic
  14. // Test fixtures containing JSON spec strings for BeyondtrustWorkloadCredentials dynamic secret generator tests.
  15. const (
  16. // validDynamicSecretSpec is a valid BeyondtrustWorkloadCredentialsDynamicSecret spec with all required fields.
  17. validDynamicSecretSpec = `apiVersion: generators.external-secrets.io/v1alpha1
  18. kind: BeyondtrustWorkloadCredentialsDynamicSecret
  19. spec:
  20. provider:
  21. folderPath: "test/aws-dynamic"
  22. auth:
  23. apikey:
  24. token:
  25. name: "beyondtrustworkloadcredentials-token"
  26. key: "token"
  27. server:
  28. apiUrl: "https://example.com"
  29. siteId: "12345678-1234-4234-8234-123456789012"`
  30. // validDynamicSecretSpecNoFolder is a spec with a secret at root level (no folder prefix).
  31. validDynamicSecretSpecNoFolder = `apiVersion: generators.external-secrets.io/v1alpha1
  32. kind: BeyondtrustWorkloadCredentialsDynamicSecret
  33. spec:
  34. provider:
  35. folderPath: "mysecret"
  36. auth:
  37. apikey:
  38. token:
  39. name: "beyondtrustworkloadcredentials-token"
  40. key: "token"
  41. server:
  42. apiUrl: "https://example.com"
  43. siteId: "12345678-1234-4234-8234-123456789012"`
  44. // specMissingFolderPath has no folderPath field.
  45. specMissingFolderPath = `apiVersion: generators.external-secrets.io/v1alpha1
  46. kind: BeyondtrustWorkloadCredentialsDynamicSecret
  47. spec:
  48. provider:
  49. auth:
  50. apikey:
  51. token:
  52. name: "beyondtrustworkloadcredentials-token"
  53. key: "token"
  54. server:
  55. apiUrl: "https://example.com"
  56. siteId: "12345678-1234-4234-8234-123456789012"`
  57. // specMissingAuth has no auth field.
  58. specMissingAuth = `apiVersion: generators.external-secrets.io/v1alpha1
  59. kind: BeyondtrustWorkloadCredentialsDynamicSecret
  60. spec:
  61. provider:
  62. folderPath: "test/dynamic-secret"
  63. server:
  64. apiUrl: "https://example.com"
  65. siteId: "12345678-1234-4234-8234-123456789012"`
  66. // specSecretNotFound references a non-existent secret.
  67. specSecretNotFound = `apiVersion: generators.external-secrets.io/v1alpha1
  68. kind: BeyondtrustWorkloadCredentialsDynamicSecret
  69. spec:
  70. provider:
  71. folderPath: "test/dynamic-secret"
  72. auth:
  73. apikey:
  74. token:
  75. name: "nonexistent-secret"
  76. key: "token"
  77. server:
  78. apiUrl: "https://example.com"
  79. siteId: "12345678-1234-4234-8234-123456789012"`
  80. // validDynamicSecretSpecWithFolder is used for error and non-string value tests.
  81. validDynamicSecretSpecWithFolder = `apiVersion: generators.external-secrets.io/v1alpha1
  82. kind: BeyondtrustWorkloadCredentialsDynamicSecret
  83. spec:
  84. provider:
  85. folderPath: "test/dynamic-secret"
  86. auth:
  87. apikey:
  88. token:
  89. name: "beyondtrustworkloadcredentials-token"
  90. key: "token"
  91. server:
  92. apiUrl: "https://example.com"
  93. siteId: "12345678-1234-4234-8234-123456789012"`
  94. // specEmptySecretName has a folderPath ending with "/" resulting in empty secret name.
  95. specEmptySecretName = `apiVersion: generators.external-secrets.io/v1alpha1
  96. kind: BeyondtrustWorkloadCredentialsDynamicSecret
  97. spec:
  98. provider:
  99. folderPath: "test/folder/"
  100. auth:
  101. apikey:
  102. token:
  103. name: "beyondtrustworkloadcredentials-token"
  104. key: "token"
  105. server:
  106. apiUrl: "https://example.com"
  107. siteId: "12345678-1234-4234-8234-123456789012"`
  108. )