Skip to content

Make unit testing easier/make examples work #3

@munnerz

Description

@munnerz

Right now if you run go test within this repository, the tests will fail.

They fail for a few reasons:

  • We don't provide any way to fetch the test binaries (i.e. kube-apiserver & etcd)
  • The actual sample will always panic on Present/CleanUp
  • We don't actually set any TXT records anywhere when Present is called, meaning the test suite will always fail

(1) can be fixed by adding a fetch-binaries.sh script (probably taken straight from sigs.k8s.io/controller-tools).

(2) and (3) can be most easily fixed by embedding a 'fake dns server' into the webhook, which will listen for DNS queries and serve TXT records accordingly. This is how cert-manager itself handles tests for the RFC2136 DNS01 provider, and there is a reusable library that we can use to build it easily: https://github.com/jetstack/cert-manager/tree/master/test/acme/dns/server

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/important-longtermImportant over the long term, but may not be staffed and/or may need multiple releases to complete.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions