Skip to content

Commit

Permalink
Adds test just to manually validate value is passed
Browse files Browse the repository at this point in the history
  • Loading branch information
luispresuelVenafi committed Feb 28, 2024
1 parent cd0324a commit cffa6df
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions pkg/venafi/tpp/connector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit cffa6df

Please sign in to comment.