Add failure scenarios to db.CreateOrder unit tests

This commit is contained in:
max furman 2021-03-25 19:40:18 -07:00
parent fd447c5b54
commit bdace1e53f
2 changed files with 8 additions and 8 deletions

View file

@ -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
}

View file

@ -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"},