mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-02 16:30:17 +02:00
ocsp: reload on ocsp response changes (#2286)
This commit is contained in:
parent
f9675f61cc
commit
b372ab4bcc
4 changed files with 262 additions and 51 deletions
31
internal/autocert/ocsp_test.go
Normal file
31
internal/autocert/ocsp_test.go
Normal file
|
@ -0,0 +1,31 @@
|
|||
package autocert
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestOcspCache(t *testing.T) {
|
||||
c, err := newOCSPCache(10)
|
||||
require.NoError(t, err)
|
||||
|
||||
cases := []struct {
|
||||
data []byte
|
||||
isUpdated bool
|
||||
}{
|
||||
{nil, false},
|
||||
{nil, false},
|
||||
{[]byte("a"), true},
|
||||
{[]byte("a"), false},
|
||||
{[]byte("b"), true},
|
||||
{[]byte("b"), false},
|
||||
{nil, true},
|
||||
{nil, false},
|
||||
}
|
||||
|
||||
for i, tc := range cases {
|
||||
assert.Equal(t, tc.isUpdated, c.updated("key", tc.data), "#%d: %v", i, tc)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue