Example #1
0
func TestPartitionSingle(t *testing.T) {
	addresses := []string{"a", "b", "c"}
	ctrl, cluster, iptables := setup(t, addresses)
	defer ctrl.Finish()

	cluster.EXPECT().Addresses().Return(addresses)
	iptables.EXPECT().Deny("a", "b")
	iptables.EXPECT().Deny("a", "c")

	n := NewNemesis(cluster)
	n.iptables = iptables
	n.PartitionSingle(0)
}
Example #2
0
func TestBridge(t *testing.T) {
	addresses := []string{"a", "b", "c", "d"}
	ctrl, cluster, iptables := setup(t, addresses)
	defer ctrl.Finish()

	cluster.EXPECT().Addresses().Return(addresses)
	iptables.EXPECT().Deny("a", "d")
	iptables.EXPECT().Deny("b", "d")

	n := NewNemesis(cluster)
	n.iptables = iptables
	n.Bridge()
}
Example #3
0
func TestHeal(t *testing.T) {
	addresses := []string{"a", "b", "c"}
	ctrl, cluster, iptables := setup(t, addresses)
	defer ctrl.Finish()

	cluster.EXPECT().Addresses().Return(addresses)
	iptables.EXPECT().Heal()

	n := NewNemesis(cluster)
	n.iptables = iptables
	n.Heal()
}
Example #4
0
func TestPartitionHalf(t *testing.T) {
	addresses := []string{"a", "b", "c"}
	ctrl, cluster, iptables := setup(t, addresses)
	defer ctrl.Finish()

	cluster.EXPECT().Addresses().Return(addresses)
	iptables.EXPECT().PartitionLevel(addresses, 1)

	n := NewNemesis(cluster)
	n.iptables = iptables
	n.PartitionHalf()
}