Sfoglia il codice sorgente

Merge pull request #1087 from smallstep/acme-validated-at

Set Challenge ValidateAt
Mariano Cano 4 anni fa
parent
commit
c071907cd1
2 ha cambiato i file con 2 aggiunte e 0 eliminazioni
  1. 1 0
      acme/challenge.go
  2. 1 0
      acme/challenge_test.go

+ 1 - 0
acme/challenge.go

@@ -729,6 +729,7 @@ func storeError(ctx context.Context, db DB, ch *Challenge, markInvalid bool, err
 	ch.Error = err
 	if markInvalid {
 		ch.Status = StatusInvalid
+		ch.ValidatedAt = clock.Now().Format(time.RFC3339)
 	}
 	if err := db.UpdateChallenge(ctx, ch); err != nil {
 		return WrapErrorISE(err, "failure saving error to acme challenge")

+ 1 - 0
acme/challenge_test.go

@@ -170,6 +170,7 @@ func Test_storeError(t *testing.T) {
 						assert.Equals(t, updch.Token, ch.Token)
 						assert.Equals(t, updch.Value, ch.Value)
 						assert.Equals(t, updch.Status, StatusInvalid)
+						assert.True(t, updch.ValidatedAt != "")
 
 						assert.HasPrefix(t, updch.Error.Err.Error(), err.Err.Error())
 						assert.Equals(t, updch.Error.Type, err.Type)