|
5 | 5 | "context" |
6 | 6 | "encoding/json" |
7 | 7 | "errors" |
| 8 | + "fmt" |
8 | 9 | "io" |
9 | 10 | "reflect" |
10 | 11 | "testing" |
@@ -67,6 +68,15 @@ func (f *fakeSAC) GetRevokedCerts(ctx context.Context, _ *sapb.GetRevokedCertsRe |
67 | 68 |
|
68 | 69 | // Return some configured contents, but only for shard 2. |
69 | 70 | func (f *fakeSAC) GetRevokedCertsByShard(ctx context.Context, req *sapb.GetRevokedCertsByShardRequest, _ ...grpc.CallOption) (grpc.ServerStreamingClient[corepb.CRLEntry], error) { |
| 71 | + // This time is based on the setting of `clk` in TestUpdateShard, |
| 72 | + // minus the setting of `lookbackPeriod` in that same function (24h). |
| 73 | + want := time.Date(2020, time.January, 17, 0, 0, 0, 0, time.UTC) |
| 74 | + got := req.ExpiresAfter.AsTime().UTC() |
| 75 | + if !got.Equal(want) { |
| 76 | + return nil, fmt.Errorf("fakeSAC.GetRevokedCertsByShard called with ExpiresAfter=%s, want %s", |
| 77 | + got, want) |
| 78 | + } |
| 79 | + |
70 | 80 | if req.ShardIdx == 2 { |
71 | 81 | return &f.revokedCertsByShard, nil |
72 | 82 | } |
@@ -220,11 +230,15 @@ func TestUpdateShard(t *testing.T) { |
220 | 230 | defer cancel() |
221 | 231 |
|
222 | 232 | clk := clock.NewFake() |
223 | | - clk.Set(time.Date(2020, time.January, 1, 0, 0, 0, 0, time.UTC)) |
| 233 | + clk.Set(time.Date(2020, time.January, 18, 0, 0, 0, 0, time.UTC)) |
224 | 234 | cu, err := NewUpdater( |
225 | 235 | []*issuance.Certificate{e1, r3}, |
226 | | - 2, 18*time.Hour, 24*time.Hour, |
227 | | - 6*time.Hour, time.Minute, 1, 1, |
| 236 | + 2, |
| 237 | + 18*time.Hour, // shardWidth |
| 238 | + 24*time.Hour, // lookbackPeriod |
| 239 | + 6*time.Hour, // updatePeriod |
| 240 | + time.Minute, // updateTimeout |
| 241 | + 1, 1, |
228 | 242 | "stale-if-error=60", |
229 | 243 | 5*time.Minute, |
230 | 244 | nil, |
|
0 commit comments