Fix the state tests using custom statePath
This commit is contained in:
parent
5930f332b8
commit
404b332e6a
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue