forked from TrueCloudLab/certificates
Set timestamp when marking an acme challenge invalid
This commit is contained in:
parent
a4f6b1ba0f
commit
5f130895f3
2 changed files with 2 additions and 0 deletions
|
@ -729,6 +729,7 @@ func storeError(ctx context.Context, db DB, ch *Challenge, markInvalid bool, err
|
||||||
ch.Error = err
|
ch.Error = err
|
||||||
if markInvalid {
|
if markInvalid {
|
||||||
ch.Status = StatusInvalid
|
ch.Status = StatusInvalid
|
||||||
|
ch.ValidatedAt = clock.Now().Format(time.RFC3339)
|
||||||
}
|
}
|
||||||
if err := db.UpdateChallenge(ctx, ch); err != nil {
|
if err := db.UpdateChallenge(ctx, ch); err != nil {
|
||||||
return WrapErrorISE(err, "failure saving error to acme challenge")
|
return WrapErrorISE(err, "failure saving error to acme challenge")
|
||||||
|
|
|
@ -170,6 +170,7 @@ func Test_storeError(t *testing.T) {
|
||||||
assert.Equals(t, updch.Token, ch.Token)
|
assert.Equals(t, updch.Token, ch.Token)
|
||||||
assert.Equals(t, updch.Value, ch.Value)
|
assert.Equals(t, updch.Value, ch.Value)
|
||||||
assert.Equals(t, updch.Status, StatusInvalid)
|
assert.Equals(t, updch.Status, StatusInvalid)
|
||||||
|
assert.True(t, updch.ValidatedAt != "")
|
||||||
|
|
||||||
assert.HasPrefix(t, updch.Error.Err.Error(), err.Err.Error())
|
assert.HasPrefix(t, updch.Error.Err.Error(), err.Err.Error())
|
||||||
assert.Equals(t, updch.Error.Type, err.Type)
|
assert.Equals(t, updch.Error.Type, err.Type)
|
||||||
|
|
Loading…
Reference in a new issue