prysm-pulse/tools/unencrypted-keys-gen/main_test.go
Preston Van Loon 3708a8f476 Add tool and script for interop testing (#3417)
* add tool and script for interop testing

* identity

* lint

* merge upstream, fix conflict, update script, add comment

* add comma separated support for --peer=

* remove NUM_VALIDATORS, comma fix

* WIP docker image

* use CI builder

* pr feedback

* whatever antoine says

* ignore git in docker

* jobs=auto

* disable remote cache

* try to cache the golang part

* try to cache the golang part

* nvm

* From Antoine with love

* fix
2019-09-09 17:31:19 -04:00

26 lines
500 B
Go

package main
import (
"bytes"
"crypto/rand"
"encoding/json"
"reflect"
"testing"
)
func TestSavesUnencryptedKeys(t *testing.T) {
ctnr := generateUnencryptedKeys(rand.Reader)
buf := new(bytes.Buffer)
if err := SaveUnencryptedKeysToFile(buf, ctnr); err != nil {
t.Fatal(err)
}
enc := buf.Bytes()
dec := &UnencryptedKeysContainer{}
if err := json.Unmarshal(enc, dec); err != nil {
t.Fatal(err)
}
if !reflect.DeepEqual(ctnr, dec) {
t.Errorf("Wanted %v, received %v", ctnr, dec)
}
}