test for attack

pull/205/head
Minh Doan 6 years ago committed by Minh Doan
parent b05ddd0015
commit ec234233ff
  1. 28
      internal/attack/attack_test.go

@ -0,0 +1,28 @@
package attack
import (
"testing"
"github.com/harmony-one/harmony/log"
"github.com/stretchr/testify/assert"
)
// Simple test for IncorrectResponse
func TestIncorrectResponse(t *testing.T) {
GetInstance().SetAttackEnabled(false)
assert.False(t, GetInstance().IncorrectResponse(), "error")
GetInstance().SetAttackEnabled(true)
}
// Simple test for UpdateConsensusReady
func TestUpdateConsensusReady(t *testing.T) {
model := GetInstance()
model.SetLogger(log.New())
model.NodeKilledByItSelf()
model.UpdateConsensusReady(model.ConsensusIDThreshold - 1)
model.DelayResponse()
model.UpdateConsensusReady(model.ConsensusIDThreshold + 1)
model.DelayResponse()
}
Loading…
Cancel
Save