Fix the state tests using custom statePath

This commit is contained in:
kaiyou 2020-05-14 12:09:14 +02:00 committed by Leo Antunes
parent 5930f332b8
commit 404b332e6a
1 changed files with 3 additions and 3 deletions

View File

@ -9,7 +9,7 @@ import (
) )
func Test_state_save_soad(t *testing.T) { func Test_state_save_soad(t *testing.T) {
statePath = "/tmp/wesher.json" statePath := "/tmp/wesher.json"
key := "abcdefghijklmnopqrstuvwxyzABCDEF" key := "abcdefghijklmnopqrstuvwxyzABCDEF"
node := common.Node{ node := common.Node{
Name: "node", Name: "node",
@ -23,11 +23,11 @@ func Test_state_save_soad(t *testing.T) {
}, },
} }
if err := cluster.state.save(); err != nil { if err := cluster.state.save(statePath); err != nil {
t.Error(err) t.Error(err)
} }
loaded := &state{} loaded := &state{}
loadState(loaded) loadState(loaded, statePath)
if !reflect.DeepEqual(cluster.state, loaded) { if !reflect.DeepEqual(cluster.state, loaded) {
t.Errorf("cluster state save then reload mistmatch: %s / %s", cluster.state, loaded) t.Errorf("cluster state save then reload mistmatch: %s / %s", cluster.state, loaded)