Skip to content

Commit

Permalink
Merge pull request #488 from itmo-eve/fix-volume-detector
Browse files Browse the repository at this point in the history
initialize eveState before feeding new values in volume detector
  • Loading branch information
mydatascience authored Jan 22, 2021
2 parents d8dd693 + c7e17bb commit 3f995f0
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions tests/volume/vol_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,22 +137,34 @@ func TestVolStatus(t *testing.T) {
states[el] = []string{"no info from controller"}
}

tc.AddProcInfo(edgeNode, checkVol(state, vols))

callback := func() {
t.Errorf("ASSERTION FAILED: expected volumes %s in %s state", vols, state)
for k, v := range states {
t.Errorf("\tactual %s: %s", k, v[len(v)-1])
if checkNewLastState(k, state) {
t.Errorf("\thistory of states for %s:", k)
for _, st := range v {
t.Errorf("\t\t%s", st)
// observe existing info object and feed them into eveState object
if err := tc.GetController().InfoLastCallback(edgeNode.GetID(), nil, eveState.InfoCallback()); err != nil {
t.Fatal(err)
}

// we are done if our eveState object is in required state
if ready := checkState(eveState, state, vols); ready == nil {

tc.AddProcInfo(edgeNode, checkVol(state, vols))

callback := func() {
t.Errorf("ASSERTION FAILED: expected volumes %s in %s state", vols, state)
for k, v := range states {
t.Errorf("\tactual %s: %s", k, v[len(v)-1])
if checkNewLastState(k, state) {
t.Errorf("\thistory of states for %s:", k)
for _, st := range v {
t.Errorf("\t\t%s", st)
}
}
}
}
}

tc.WaitForProcWithErrorCallback(secs, callback)
tc.WaitForProcWithErrorCallback(secs, callback)

} else {
t.Log(ready)
}

// sleep to reduce concurrency effects
time.Sleep(1 * time.Second)
Expand Down

0 comments on commit 3f995f0

Please sign in to comment.