Created
October 13, 2016 02:38
-
-
Save clsung/181f09063776407c5a45e3f6d32590d1 to your computer and use it in GitHub Desktop.
Test GRPC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TestRMsvrSuccess test success case, this can't fail | |
func (s *FailTestSuite) TestRMsvrSuccess() { | |
err := StartResourceMgr(s.chErr, config.Config.QueueSize, config.Config.RMServerAddr, config.Config.QueuedTaskTTL) | |
assert.NoError(s.T(), err) | |
var conn *grpc.ClientConn | |
for ts := 250; ts <= 1000; ts += 250 { | |
time.Sleep(time.Duration(ts) * time.Millisecond) | |
conn, err = grpc.Dial(config.Config.RMServerAddr, grpc.WithInsecure(), grpc.WithTimeout(5*time.Second)) | |
if err == nil { | |
break | |
} | |
} | |
assert.NoError(s.T(), err, "should have no error") | |
cli := rmpb.NewServiceClient(conn) | |
assert.NoError(s.T(), err, "should have no error") | |
stopreq := &rmpb.Empty{} | |
_, err = cli.StopService(context.Background(), stopreq) | |
assert.NoError(s.T(), err, "should have no error") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment