mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-22 21:47:16 +02:00
use incremental API for envoy xDS (#1732)
* use incremental API * add test * use backoff v4 * remove panic, add comment to exponential try, add test for HashProto * merge master * fix missing import
This commit is contained in:
parent
a07d85b174
commit
3524697f6f
12 changed files with 511 additions and 238 deletions
|
@ -8,6 +8,9 @@ import (
|
|||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"google.golang.org/protobuf/types/known/structpb"
|
||||
)
|
||||
|
||||
func TestPasswordHashing(t *testing.T) {
|
||||
|
@ -79,3 +82,25 @@ func ExampleHash() {
|
|||
fmt.Println(hex.EncodeToString(digest))
|
||||
// Output: 9f4c795d8ae5c207f19184ccebee6a606c1fdfe509c793614066d613580f03e1
|
||||
}
|
||||
|
||||
func TestHashProto(t *testing.T) {
|
||||
// This test will hash a protobuf message that has a map 1000 times
|
||||
// each attempt should result in the same hash if the output is
|
||||
// deterministic.
|
||||
var cur []byte
|
||||
for i := 0; i < 1000; i++ {
|
||||
s, err := structpb.NewStruct(map[string]interface{}{
|
||||
"1": "a", "2": "b", "3": "c", "4": "d",
|
||||
"5": "e", "6": "f", "7": "g", "8": "h",
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
if i == 0 {
|
||||
cur = HashProto(s)
|
||||
} else {
|
||||
nxt := HashProto(s)
|
||||
if !assert.Equal(t, cur, nxt) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue