Skip to content

Commit

Permalink
[FAB-10906] Fix failing TestGetCertificatesDB
Browse files Browse the repository at this point in the history
Test started failing because a static date is used,
but a dynamically generated date is need for this
particular assertion. Updated the test case to generate
a future date dynamically based on current date.

Change-Id: I3ce84d0a03328ac8b013adbb20bdf9a9a4495ffd
Signed-off-by: Saad Karim <[email protected]>
  • Loading branch information
Saad Karim committed Jun 27, 2018
1 parent b00c1cb commit e44bf12
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/certdbaccessor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ func TestGetCertificatesDB(t *testing.T) {
certs, err = readRows(rows)
assert.Equal(t, 6, len(certs))

expiredEnd := time.Date(2018, time.July, 1, 0, 0, 0, 0, time.UTC)
dur, err := time.ParseDuration("+100h")
expiredEnd := time.Now().Add(dur).UTC()
certReq = getCertReq("", "", "", false, false, nil, nil, nil, &expiredEnd)
rows, err = ca.certDBAccessor.GetCertificates(certReq, "")
assert.NoError(t, err, "Failed to get certificates from database")
Expand Down Expand Up @@ -221,7 +222,6 @@ func populateCertificatesTable(t *testing.T, ca *CA) {
util.FatalError(t, err, "Failed to insert certificate with expiration date")

// Not Expired

err = testInsertCertificate(&certdb.CertificateRecord{
Serial: "1122",
AKI: "98765",
Expand Down

0 comments on commit e44bf12

Please sign in to comment.