-
Notifications
You must be signed in to change notification settings - Fork 456
Improve test case #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
6294ce1
3bb6f6c
9b4aa49
f96df3b
296fbde
060ffb3
7621c67
7415d9a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ import ( | |
|
||
"github.com/jetstack/cert-manager/pkg/acme/webhook/apis/acme/v1alpha1" | ||
"github.com/jetstack/cert-manager/pkg/acme/webhook/cmd" | ||
certmanagerv1 "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha1" | ||
) | ||
|
||
var GroupName = os.Getenv("GROUP_NAME") | ||
|
@@ -64,8 +65,8 @@ type customDNSProviderConfig struct { | |
// These fields will be set by users in the | ||
// `issuer.spec.acme.dns01.providers.webhook.config` field. | ||
|
||
//Email string `json:"email"` | ||
//APIKeySecretRef v1alpha1.SecretKeySelector `json:"apiKeySecretRef"` | ||
Email string `json:"email"` | ||
APIKeySecretRef certmanagerv1.SecretKeySelector `json:"apiKeySecretRef"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not all of these fields are required by all DNS provider types, hence keeping the contents here generic. Can you revert these changes, and if you feel there could be additional clarification as to what a user should do here then add comments to explain it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think that I included them or maybe this is because they were defined within one of the example of the cert manager project. So, do you suggest that we remove the fields |
||
} | ||
|
||
// Name is used as the name for this DNS solver when referencing it on the ACME | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,54 @@ | ||
package main | ||
|
||
import ( | ||
cmapi "github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha1" | ||
logf "github.com/jetstack/cert-manager/pkg/logs" | ||
"github.com/jetstack/cert-manager/test/acme/dns" | ||
testserver "github.com/jetstack/cert-manager/test/acme/dns/server" | ||
"os" | ||
"testing" | ||
|
||
"github.com/jetstack/cert-manager/test/acme/dns" | ||
) | ||
|
||
var ( | ||
zone = os.Getenv("TEST_ZONE_NAME") | ||
kubeBuilderBinPath = "./_out/kubebuilder/bin" | ||
rfc2136TestFqdn = "_acme-challenge.123456789.www.example.com." | ||
rfc2136TestZone = "example.com." | ||
rfc2136TestTsigKeyName = "example.com." | ||
rfc2136TestTsigSecret = "IwBTJx9wrDp4Y1RyC3H0gA==" | ||
) | ||
|
||
func TestRunsSuite(t *testing.T) { | ||
// The manifest path should contain a file named config.json that is a | ||
// snippet of valid configuration that should be included on the | ||
// ChallengeRequest passed as part of the test cases. | ||
|
||
ctx := logf.NewContext(nil, nil, t.Name()) | ||
server := &testserver.BasicServer{ | ||
Zones: []string{rfc2136TestZone}, | ||
EnableTSIG: true, | ||
TSIGZone: rfc2136TestZone, | ||
TSIGKeyName: rfc2136TestTsigKeyName, | ||
TSIGKeySecret: rfc2136TestTsigSecret, | ||
} | ||
if err := server.Run(ctx); err != nil { | ||
t.Fatalf("failed to start test server: %v", err) | ||
} | ||
defer server.Shutdown() | ||
|
||
var validConfig = cmapi.ACMEIssuerDNS01ProviderRFC2136{ | ||
Nameserver: server.ListenAddr(), | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Referencing the RFC2136 solver here is confusing to users, and also won't result in the RFC2136 issuer actually being used (as Having the binaries path set + the script to fetch those binaries is great, but I think this example should be generic and show a basic setup that needs a bit of modification or commenting/uncommenting of example lines to get things to work. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, what do you suggest that we do then here ? |
||
|
||
fixture := dns.NewFixture(&customDNSProviderSolver{}, | ||
dns.SetBinariesPath(kubeBuilderBinPath), | ||
dns.SetResolvedZone(zone), | ||
dns.SetResolvedFQDN(rfc2136TestFqdn), | ||
dns.SetConfig(validConfig), | ||
dns.SetDNSServer(server.ListenAddr()), | ||
dns.SetAllowAmbientCredentials(false), | ||
dns.SetManifestPath("testdata/my-custom-solver"), | ||
dns.SetUseAuthoritative(false), | ||
) | ||
|
||
fixture.RunConformance(t) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,61 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
#hack_dir=$(dirname ${BASH_SOURCE}) | ||
#source ${hack_dir}/common.sh | ||
|
||
k8s_version=1.14.1 | ||
goarch=amd64 | ||
goos="unknown" | ||
|
||
if [[ "$OSTYPE" == "linux-gnu" ]]; then | ||
goos="linux" | ||
elif [[ "$OSTYPE" == "darwin"* ]]; then | ||
goos="darwin" | ||
fi | ||
|
||
if [[ "$goos" == "unknown" ]]; then | ||
echo "OS '$OSTYPE' not supported. Aborting." >&2 | ||
exit 1 | ||
fi | ||
|
||
tmp_root=./_out | ||
kb_root_dir=$tmp_root/kubebuilder | ||
|
||
# Turn colors in this script off by setting the NO_COLOR variable in your | ||
# environment to any value: | ||
# | ||
# $ NO_COLOR=1 test.sh | ||
NO_COLOR=${NO_COLOR:-""} | ||
if [ -z "$NO_COLOR" ]; then | ||
header=$'\e[1;33m' | ||
reset=$'\e[0m' | ||
else | ||
header='' | ||
reset='' | ||
fi | ||
|
||
function header_text { | ||
echo "$header$*$reset" | ||
} | ||
|
||
# fetch k8s API gen tools and make it available under kb_root_dir/bin. | ||
function fetch_kb_tools { | ||
header_text "fetching tools" | ||
mkdir -p $tmp_root | ||
kb_tools_archive_name="kubebuilder-tools-$k8s_version-$goos-$goarch.tar.gz" | ||
kb_tools_download_url="https://storage.googleapis.com/kubebuilder-tools/$kb_tools_archive_name" | ||
|
||
kb_tools_archive_path="$tmp_root/$kb_tools_archive_name" | ||
if [ ! -f $kb_tools_archive_path ]; then | ||
curl -sL ${kb_tools_download_url} -o "$kb_tools_archive_path" | ||
fi | ||
tar -zvxf "$kb_tools_archive_path" -C "$tmp_root/" | ||
} | ||
|
||
header_text "using tools" | ||
fetch_kb_tools | ||
|
||
header_text "kubebuilder tools (etcd, kubectl, kube-apiserver)used to perform local tests installed under $tmp_root/kubebuilder/bin/" | ||
exit 0 |
Uh oh!
There was an error while loading. Please reload this page.