Skip to content
Snippets Groups Projects
Commit d0790967 authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Update outputs to make them workable in the test

parent 19c50fc8
Branches
Tags
No related merge requests found
...@@ -159,8 +159,10 @@ var rootCmd = &cobra.Command{ ...@@ -159,8 +159,10 @@ var rootCmd = &cobra.Command{
msgBody := viper.GetString("message") msgBody := viper.GetString("message")
recipientID, isPrecanPartner := parseRecipient( recipientID, isPrecanPartner := parseRecipient(
viper.GetString("destid")) viper.GetString("destid"))
// Send unsafe messages or not?
unsafe := viper.GetBool("unsafe")
if isPrecanPartner { if isPrecanPartner && !unsafe {
jww.WARN.Printf("Precanned user id detected: %s", jww.WARN.Printf("Precanned user id detected: %s",
recipientID) recipientID)
preUsr, err := client.MakePrecannedAuthenticatedChannel( preUsr, err := client.MakePrecannedAuthenticatedChannel(
...@@ -177,7 +179,7 @@ var rootCmd = &cobra.Command{ ...@@ -177,7 +179,7 @@ var rootCmd = &cobra.Command{
preBytes, idBytes) preBytes, idBytes)
} }
} }
} else { } else if !unsafe {
jww.FATAL.Panicf("e2e unimplemented") jww.FATAL.Panicf("e2e unimplemented")
} }
...@@ -191,7 +193,6 @@ var rootCmd = &cobra.Command{ ...@@ -191,7 +193,6 @@ var rootCmd = &cobra.Command{
sendCnt := int(viper.GetUint("sendCount")) sendCnt := int(viper.GetUint("sendCount"))
sendDelay := time.Duration(viper.GetUint("sendDelay")) sendDelay := time.Duration(viper.GetUint("sendDelay"))
unsafe := viper.GetBool("unsafe")
for i := 0; i < sendCnt; i++ { for i := 0; i < sendCnt; i++ {
fmt.Printf("Sending to %s: %s\n", recipientID, msgBody) fmt.Printf("Sending to %s: %s\n", recipientID, msgBody)
var roundIDs []id.Round var roundIDs []id.Round
...@@ -211,7 +212,8 @@ var rootCmd = &cobra.Command{ ...@@ -211,7 +212,8 @@ var rootCmd = &cobra.Command{
// Wait until message timeout or we receive enough then exit // Wait until message timeout or we receive enough then exit
// TODO: Actually check for how many messages we've received // TODO: Actually check for how many messages we've received
receiveCnt := viper.GetUint("receiveCount") expectedCnt := viper.GetUint("receiveCount")
receiveCnt := uint(0)
waitTimeout := time.Duration(viper.GetUint("waitTimeout")) waitTimeout := time.Duration(viper.GetUint("waitTimeout"))
timeoutTimer := time.NewTimer(waitTimeout * time.Second) timeoutTimer := time.NewTimer(waitTimeout * time.Second)
done := false done := false
...@@ -224,10 +226,14 @@ var rootCmd = &cobra.Command{ ...@@ -224,10 +226,14 @@ var rootCmd = &cobra.Command{
case m := <-recvCh: case m := <-recvCh:
fmt.Printf("Message received: %s\n", string( fmt.Printf("Message received: %s\n", string(
m.Payload)) m.Payload))
receiveCnt++
if receiveCnt == expectedCnt {
done = true
}
break break
} }
} }
fmt.Printf("Received %d", receiveCnt) fmt.Printf("Received %d\n", receiveCnt)
}, },
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment