suite: "Test GitHub Secret Annotations"
templates:
  - githubsecret.yaml
tests:
  - it: should include global annotations
    set:
      scaleset.name: "test"
      auth.url: "https://github.com/org"
      auth.githubToken: "gh_token12345"
      resource:
        all:
          metadata:
            annotations:
              a: "global"
              shared: "global"
    release:
      name: "test-name"
      namespace: "test-namespace"
    asserts:
      - equal:
          path: metadata.annotations.a
          value: "global"
      - equal:
          path: metadata.annotations.shared
          value: "global"

  - it: should drop actions.github.com annotations from global config
    set:
      scaleset.name: "test"
      auth.url: "https://github.com/org"
      auth.githubToken: "gh_token12345"
      resource:
        all:
          metadata:
            annotations:
              ok: "ok"
              actions.github.com/values-hash: "user-value"
              actions.github.com/cleanup-something: "should-not-render"
    release:
      name: "test-name"
      namespace: "test-namespace"
    asserts:
      - equal:
          path: metadata.annotations.ok
          value: "ok"
      - notExists:
          path: metadata.annotations["actions.github.com/values-hash"]
      - notExists:
          path: metadata.annotations["actions.github.com/cleanup-something"]
