prysm-pulse/beacon-chain/db/simulator_test.go
Nishant Das 16b04699d0 Allow Initial Sync to Work with Simulator (#669)
* polling interval

* adding proto message

* changing proto messages

* changing naming

* adding slot functionality

* initial sync working

* new changes

* more sync fixes

* its working now

* finally working

* add tests

* fix tests

* tests

* adding tests

* lint

* log checks

* making changes to simulator

* update logs

* fix tests

* get sync to work with crystallized state

* fixing race

* making requested changes

* unexport

* documentation

* gazelle and fix merge conflicts

* adding repeated requests

* fix lint

* adding new clock , db methods, and util func

* revert change to test

* gazelle

* add in test

* gazelle

* finally working

* save slot

* fix lint and constant
2018-11-21 10:00:36 -08:00

37 lines
632 B
Go

package db
import (
"testing"
)
func TestSaveAndGetSlot(t *testing.T) {
db := setupDB(t)
defer teardownDB(t, db)
retSlot, err := db.GetSimulatorSlot()
if err != nil {
t.Fatalf("get slot failed: %v", err)
}
if retSlot != 0 {
t.Fatalf("empty db does not have a simulator slot of 0")
}
slot := uint64(10)
err = db.SaveSimulatorSlot(slot)
if err != nil {
t.Fatalf("save slot failed: %v", err)
}
retSlot, err = db.GetSimulatorSlot()
if err != nil {
t.Fatalf("get slot failed: %v", err)
}
if retSlot != slot {
t.Errorf("retrieved slot not the same as the one saved to disk %d : %d", retSlot, slot)
}
}