func (round *RoundCosi) CheckChildren() { c := round.Node.Children(round.Node.ViewNo) if len(c) != len(round.Cosi.Children) { dbg.Print("Children in cosi and node are different") dbg.Printf("round.Cosi: %+v", round.Cosi) dbg.Printf("Node.Children: %+v", round.Node.Children(round.Node.ViewNo)) dbg.Print("viewNbr:", round.SaveViewNo, "Node.ViewNo:", round.Node.ViewNo) debug.PrintStack() } }
func TestSigScanner(t *testing.T) { dbg.TestOutput(testing.Verbose(), 4) signame := "/tmp/sigs.txt" ioutil.WriteFile(signame, []byte(TestFileSignatures), 0660) blocks, err := SigScanner(signame) if err != nil { t.Fatal("Error while parsing blocks:", err) } dbg.Printf("%+v", blocks) }
func TestPolicyScanner(t *testing.T) { dbg.TestOutput(testing.Verbose(), 4) polname := "/tmp/policy.txt" ioutil.WriteFile(polname, []byte(TestFilePolicy), 0660) thres, devkeys, cothkey, err := PolicyScanner(polname) if err != nil { t.Fatal("Error while parsing blocks:", err) } dbg.Printf("%+v\n %+v\n %+v\n", thres, devkeys, cothkey) }
func TestVerification(t *testing.T) { dbg.TestOutput(testing.Verbose(), 4) var ( PolicyFile = "example/policy.txt" SignaturesFile = "example/signatures.txt" CommitIdFile = "example/commitid.txt" ) commitId, _ := CommitScanner(CommitIdFile) decision, err := ApprovalCheck(PolicyFile, SignaturesFile, commitId) if err != nil { dbg.Panic("Problem with verifying approval of developers", err) } // dbg.Printf("How many signatures have been read? %+v", len(co.Signatures)) // dbg.Printf("What is a threshold value? %+v", co.Policy.Threshold) dbg.Printf("Is commit approved? %+v", decision) }