Skip to content

Commit

Permalink
Review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lukedirtwalker committed Jul 25, 2018
1 parent 60d2fdb commit 1f7ca55
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 1 addition & 3 deletions go/examples/pingpong/pp_integration/pingpong.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func realMain() int {
return 1
}
// TODO(lukedirtwalker) we should enable logging
// depeding on the main log parameter it should either go to a file or to console stderr.
// depending on the main log parameter it should either go to a file or to console stderr.
in := integration.NewBinaryIntegration("./bin/pingpong",
[]string{"-mode", "client", "-sciondFromIA", "-count", "1",
"-local", integration.SrcIAReplace + ",[127.0.0.1]:0",
Expand All @@ -62,7 +62,6 @@ func realMain() int {
// In case of an error the function is terminated immediately.
func runTests(in integration.Integration, pairs []integration.IAPair) error {
return integration.ExecuteTimed(in.Name(), func() error {

// First run all servers
dsts := integration.ExtractUniqueDsts(pairs)
for _, dst := range dsts {
Expand All @@ -72,7 +71,6 @@ func runTests(in integration.Integration, pairs []integration.IAPair) error {
}
defer c.Close()
}

// Now start the clients for srcDest pair
for i, conn := range pairs {
log.Info(fmt.Sprintf("Test %v: %v -> %v (%v/%v)",
Expand Down
8 changes: 6 additions & 2 deletions go/lib/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package integration provides function to simplify the creation of integration tests.
// Package integration simplifies the creation of integration tests.
package integration

import (
Expand Down Expand Up @@ -152,8 +152,12 @@ func RunClient(in Integration, pair IAPair, timeout time.Duration) error {
func ExecuteTimed(name string, f func() error) error {
start := time.Now()
err := f()
result := "successful"
if err != nil {
result = "failed"
}
elapsed := time.Since(start)
fmt.Printf("Test %v successful, used %v\n", name, elapsed)
fmt.Printf("Test %s %s, used %v\n", name, result, elapsed)
return err
}

Expand Down

0 comments on commit 1f7ca55

Please sign in to comment.