tun2: fix TestBackendRouting
This commit is contained in:
parent
adf2121326
commit
2a06070bec
|
@ -214,8 +214,8 @@ func (s *Server) backendAuthv1(ctx context.Context, st io.Reader) (string, *Auth
|
|||
return "", nil, err
|
||||
}
|
||||
|
||||
f["auth_domain"] = auth.Domain
|
||||
f["stage"] = "checking domain"
|
||||
ln.Log(ctx, f)
|
||||
|
||||
routeUser, err := s.cfg.Storage.HasRoute(auth.Domain)
|
||||
if err != nil {
|
||||
|
@ -225,7 +225,6 @@ func (s *Server) backendAuthv1(ctx context.Context, st io.Reader) (string, *Auth
|
|||
|
||||
f["route_user"] = routeUser
|
||||
f["stage"] = "checking token"
|
||||
ln.Log(ctx, f)
|
||||
|
||||
tokenUser, scopes, err := s.cfg.Storage.HasToken(auth.Token)
|
||||
if err != nil {
|
||||
|
@ -235,7 +234,6 @@ func (s *Server) backendAuthv1(ctx context.Context, st io.Reader) (string, *Auth
|
|||
|
||||
f["token_user"] = tokenUser
|
||||
f["stage"] = "checking token scopes"
|
||||
ln.Log(ctx, f)
|
||||
|
||||
ok := false
|
||||
for _, sc := range scopes {
|
||||
|
@ -251,7 +249,6 @@ func (s *Server) backendAuthv1(ctx context.Context, st io.Reader) (string, *Auth
|
|||
}
|
||||
|
||||
f["stage"] = "user verification"
|
||||
ln.Log(ctx, f)
|
||||
|
||||
if routeUser != tokenUser {
|
||||
ln.Error(ctx, ErrAuthMismatch, f)
|
||||
|
|
|
@ -199,6 +199,9 @@ func TestBackendRouting(t *testing.T) {
|
|||
ServerAddr: l.Addr().String(),
|
||||
Token: token,
|
||||
BackendURL: ts.URL,
|
||||
Domain: domain,
|
||||
|
||||
forceTCPClear: true,
|
||||
}
|
||||
|
||||
c, err := NewClient(cc)
|
||||
|
@ -206,9 +209,9 @@ func TestBackendRouting(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
go c.Connect(ctx) //
|
||||
go c.Connect(ctx) // TODO: fix the client library so this ends up actually getting cleaned up
|
||||
|
||||
time.Sleep(5 * time.Second)
|
||||
time.Sleep(time.Second)
|
||||
|
||||
req, err := http.NewRequest("GET", "http://cetacean.club/", nil)
|
||||
if err != nil {
|
||||
|
|
|
@ -57,7 +57,7 @@ func (ms *mockStorage) HasRoute(domain string) (string, error) {
|
|||
|
||||
user, ok := ms.domains[domain]
|
||||
if !ok {
|
||||
return "", nil
|
||||
return "", errors.New("no such route")
|
||||
}
|
||||
|
||||
return user, nil
|
||||
|
|
Loading…
Reference in New Issue