Honor autoSubscribe when subscription permissions are granted later (#381)

* Ensure autosubscribe is honored when subscription permissions were granted later

* negotiate even if no media has been added

* don't double-negotiate
This commit is contained in:
David Zhao
2022-01-28 09:55:10 -08:00
committed by GitHub
parent 30c175e9a7
commit 9747243ce2
9 changed files with 231 additions and 35 deletions
+17 -1
View File
@@ -2,6 +2,7 @@ package test
import (
"context"
"errors"
"fmt"
"net"
"net/http"
@@ -184,7 +185,22 @@ func (s *webhookTestServer) Start() error {
return err
}
go s.server.Serve(l)
return nil
// wait for webhook server to start
ctx, cancel := context.WithTimeout(context.Background(), testutils.ConnectTimeout)
defer cancel()
for {
select {
case <-ctx.Done():
return errors.New("could not start webhook server after timeout")
case <-time.After(10 * time.Millisecond):
// ensure we can connect to it
res, err := http.Get(fmt.Sprintf("http://localhost%s", s.server.Addr))
if err == nil && res.StatusCode == http.StatusOK {
return nil
}
}
}
}
func (s *webhookTestServer) Stop() {