Add failure scenarios to db.CreateOrder unit tests

pull/496/head
max furman 3 years ago
parent fd447c5b54
commit bdace1e53f

@ -3,7 +3,6 @@ package nosql
import (
"context"
"encoding/json"
"fmt"
"sync"
"time"
@ -95,7 +94,6 @@ func (db *DB) CreateOrder(ctx context.Context, o *acme.Order) error {
NotAfter: o.NotAfter,
AuthorizationIDs: o.AuthorizationIDs,
}
fmt.Printf("dbo = %+v\n", dbo)
if err := db.save(ctx, o.ID, dbo, nil, "order", orderTable); err != nil {
return err
}

@ -385,6 +385,8 @@ func TestDB_UpdateOrder(t *testing.T) {
func TestDB_CreateOrder(t *testing.T) {
now := clock.Now()
nbf := now.Add(5 * time.Minute)
naf := now.Add(15 * time.Minute)
type test struct {
db nosql.DB
o *acme.Order
@ -399,8 +401,8 @@ func TestDB_CreateOrder(t *testing.T) {
CertificateID: "certID",
Status: acme.StatusValid,
ExpiresAt: now,
NotBefore: now,
NotAfter: now,
NotBefore: nbf,
NotAfter: naf,
Identifiers: []acme.Identifier{
{Type: "dns", Value: "test.ca.smallstep.com"},
{Type: "dns", Value: "example.foo.com"},
@ -443,8 +445,8 @@ func TestDB_CreateOrder(t *testing.T) {
CertificateID: "certID",
Status: acme.StatusValid,
ExpiresAt: now,
NotBefore: now,
NotAfter: now,
NotBefore: nbf,
NotAfter: naf,
Identifiers: []acme.Identifier{
{Type: "dns", Value: "test.ca.smallstep.com"},
{Type: "dns", Value: "example.foo.com"},
@ -496,8 +498,8 @@ func TestDB_CreateOrder(t *testing.T) {
ProvisionerID: "provID",
Status: acme.StatusValid,
ExpiresAt: now,
NotBefore: now,
NotAfter: now,
NotBefore: nbf,
NotAfter: naf,
Identifiers: []acme.Identifier{
{Type: "dns", Value: "test.ca.smallstep.com"},
{Type: "dns", Value: "example.foo.com"},

Loading…
Cancel
Save