From cffa6dfb6a4a5c769f4c16a55fc269ef8e477a8f Mon Sep 17 00:00:00 2001 From: Luis Presuel Date: Wed, 28 Feb 2024 11:37:41 -0600 Subject: [PATCH] Adds test just to manually validate value is passed --- pkg/venafi/tpp/connector_test.go | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/pkg/venafi/tpp/connector_test.go b/pkg/venafi/tpp/connector_test.go index 5252bdca..8604f696 100644 --- a/pkg/venafi/tpp/connector_test.go +++ b/pkg/venafi/tpp/connector_test.go @@ -500,7 +500,7 @@ func TestRequestCertificateUserPassword(t *testing.T) { t.Fatalf("err is not nil, err: %s", err) } } - DoRequestCertificate(t, tpp) + DoRequestCertificate(t, tpp, 0) } func TestRequestCertificateToken(t *testing.T) { @@ -515,7 +515,24 @@ func TestRequestCertificateToken(t *testing.T) { t.Fatalf("err is not nil, err: %s", err) } } - DoRequestCertificate(t, tpp) + DoRequestCertificate(t, tpp, 0) +} + +func TestRequestCertificateTokenWithExtendedTimeout(t *testing.T) { + t.Skip("Skipping as we cannot make TPP to hold the amount of time we want to properly test this") + tpp, err := getTestConnector(ctx.TPPurl, ctx.TPPZone) + if err != nil { + t.Fatalf("err is not nil, err: %s url: %s", err, expectedURL) + } + + if tpp.apiKey == "" { + err = tpp.Authenticate(&endpoint.Authentication{AccessToken: ctx.TPPaccessToken}) + if err != nil { + t.Fatalf("err is not nil, err: %s", err) + } + } + timeout, _ := time.ParseDuration("45s") + DoRequestCertificate(t, tpp, timeout) } func TestRequestCertificateWithValidityHours(t *testing.T) { @@ -1106,7 +1123,7 @@ func DoRequestCertificateWithValidityDuration(t *testing.T, tpp *Connector) { } -func DoRequestCertificate(t *testing.T, tpp *Connector) { +func DoRequestCertificate(t *testing.T, tpp *Connector, timeout time.Duration) { config, err := tpp.ReadZoneConfiguration() if err != nil { t.Fatalf("err is not nil, err: %s", err) @@ -1126,6 +1143,9 @@ func DoRequestCertificate(t *testing.T, tpp *Connector) { req.CustomFields = []certificate.CustomField{ {Name: "custom", Value: "2019-10-10"}, } + if timeout != 0 { + req.Timeout = timeout + } err = tpp.GenerateRequest(config, req) if err != nil { t.Fatalf("err is not nil, err: %s", err)