Ensure RoomService operation is complete prior to returning (#362)
* Ensure service doesn't return before operation is complete * added integration tests for RoomService
This commit is contained in:
@@ -101,7 +101,11 @@ func waitForServerToStart(s *service.LivekitServer) {
|
||||
panic("could not start server after timeout")
|
||||
case <-time.After(10 * time.Millisecond):
|
||||
if s.IsRunning() {
|
||||
return
|
||||
// ensure we can connect to it
|
||||
res, err := http.Get(fmt.Sprintf("http://localhost:%d", s.HTTPPort()))
|
||||
if err == nil && res.StatusCode == http.StatusOK {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -258,6 +262,16 @@ func createRoomToken() string {
|
||||
return t
|
||||
}
|
||||
|
||||
func adminRoomToken(name string) string {
|
||||
at := auth.NewAccessToken(testApiKey, testApiSecret).
|
||||
AddGrant(&auth.VideoGrant{RoomAdmin: true, Room: name})
|
||||
t, err := at.ToJWT()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return t
|
||||
}
|
||||
|
||||
func listRoomToken() string {
|
||||
at := auth.NewAccessToken(testApiKey, testApiSecret).
|
||||
AddGrant(&auth.VideoGrant{RoomList: true})
|
||||
|
||||
Reference in New Issue
Block a user