suite: Test S3 Secret
templates:
- s3-secret.yaml
- _helpers.tpl
tests:
- it: should set name
  template: s3-secret.yaml
  set:
    s3:
      enabled: true
      bucketName: "yourbucket"
      endpoint: "https://s3.amazonaws.com"
  asserts:
  - equal:
      path: metadata.name
      value: "rancher-backup-s3"
- it: should set namespace
  template: s3-secret.yaml
  set:
    s3:
      enabled: true
      bucketName: "yourbucket"
      endpoint: "https://s3.amazonaws.com"
  asserts:
  - equal:
      path: metadata.namespace
      value: "NAMESPACE"
- it: should not set credentialSecretName
  template: s3-secret.yaml
  set:
    s3:
      enabled: true
      bucketName: "yourbucket"
      endpoint: "https://s3.amazonaws.com"
  asserts:
  - isNull:
      path: stringData.credentialSecretName
- it: should set credentialSecretName
  template: s3-secret.yaml
  set:
    s3:
      enabled: true
      bucketName: "yourbucket"
      endpoint: "https://s3.amazonaws.com"
      credentialSecretName: "credential-secret-name"
      credentialSecretNamespace: "credential-secret-namespace"
  asserts:
  - equal:
      path: stringData.credentialSecretName
      value: "credential-secret-name"
  - equal:
      path: stringData.credentialSecretNamespace
      value: "credential-secret-namespace"
- it: should not set folder
  template: s3-secret.yaml
  set:
    s3:
      enabled: true
      bucketName: "yourbucket"
      endpoint: "https://s3.amazonaws.com"
  asserts:
  - isNull:
      path: stringData.folder
- it: should set folder
  template: s3-secret.yaml
  set:
    s3:
      enabled: true
      bucketName: "yourbucket"
      endpoint: "https://s3.amazonaws.com"
      folder: "myfolder"
  asserts:
  - equal:
      path: stringData.folder
      value: "myfolder"
- it: should not set region
  template: s3-secret.yaml
  set:
    s3:
      enabled: true
      bucketName: "yourbucket"
      endpoint: "https://s3.amazonaws.com"
  asserts:
  - isNull:
      path: stringData.region
- it: should set region
  template: s3-secret.yaml
  set:
    s3:
      enabled: true
      bucketName: "yourbucket"
      endpoint: "https://s3.amazonaws.com"
      region: "us-west-1"
  asserts:
  - equal:
      path: stringData.region
      value: "us-west-1"
- it: should not set endpointCA
  template: s3-secret.yaml
  set:
    s3:
      enabled: true
      bucketName: "yourbucket"
      endpoint: "https://s3.amazonaws.com"
  asserts:
  - isNull:
      path: stringData.endpointCA
- it: should set endpointCA
  template: s3-secret.yaml
  set:
    s3:
      enabled: true
      bucketName: "yourbucket"
      endpoint: "https://s3.amazonaws.com"
      endpointCA: "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURHakNDQWdLZ0F3SUJBZ0lKQUtpWFZpNEpBb0J5TUEwR0NTcUdTSWIzRFFFQkN3VUFNQkl4RURBT0JnTlYKQkFNTUIzUmxjM1F0WTJFd0hoY05NakF3T0RNd01UZ3lOVFE1V2hjTk1qQXhNREk1TVRneU5UUTVXakFTTVJBdwpEZ1lEVlFRRERBZDBaWE4wTFdOaE1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBCjA4dnV3Q2Y0SEhtR2Q2azVNTmozRW5NOG00T2RpS3czSGszd1NlOUlXQkwyVzY5WDZxenBhN2I2M3U2L05mMnkKSnZWNDVqeXplRFB6bFJycjlpbEpWaVZ1NFNqWlFjdG9jWmFCaVNsL0xDbEFDdkFaUlYvKzN0TFVTZSs1ZDY0QQpWcUhDQlZObU5xM3E3aVY0TE1aSVpRc3N6K0FxaU1Sd0pOMVVKQTZ6V0tUc2Yzc3ByQ0J2dWxJWmZsVXVETVAyCnRCTCt6cXZEc0pDdWlhNEEvU2JNT29tVmM2WnNtTGkwMjdub3dGRld3MnRpSkM5d0xMRE14NnJoVHQ4a3VvVHYKQXJpUjB4WktiRU45L1Uzb011eUVKbHZyck9YS2ZuUDUwbk8ycGNaQnZCb3pUTStYZnRvQ1d5UnhKUmI5cFNTRApKQjlmUEFtLzNZcFpMMGRKY2sxR1h3SURBUUFCbzNNd2NUQWRCZ05WSFE0RUZnUVU5NHU4WXlMdmE2MTJnT1pyCm44QnlFQ2NucVFjd1FnWURWUjBqQkRzd09ZQVU5NHU4WXlMdmE2MTJnT1pybjhCeUVDY25xUWVoRnFRVU1CSXgKR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w2RXBaUVpWMW1DRklrdFBwSQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0t"
- it: should not set insecureTLSSkipVerify
  template: s3-secret.yaml
  set:
    s3:
      enabled: true
      bucketName: "yourbucket"
      endpoint: "https://s3.amazonaws.com"
  asserts:
  - isNull:
      path: stringData.insecureTLSSkipVerify
- it: should set insecureTLSSkipVerify
  template: s3-secret.yaml
  set:
    s3:
      enabled: true
      bucketName: "yourbucket"
      endpoint: "https://s3.amazonaws.com"
      insecureTLSSkipVerify: "true"
  asserts:
  - equal:
      path: stringData.insecureTLSSkipVerify
      value: "true"
