@ -264,6 +264,17 @@ func (cc *mockControl) UpdateEndpoints(endpoints []tailcfg.Endpoint) {
cc . called ( "UpdateEndpoints" )
cc . called ( "UpdateEndpoints" )
}
}
func ( b * LocalBackend ) nonInteractiveLoginForStateTest ( ) {
b . mu . Lock ( )
if b . cc == nil {
panic ( "LocalBackend.assertClient: b.cc == nil" )
}
cc := b . cc
b . mu . Unlock ( )
cc . Login ( nil , b . loginFlags | controlclient . LoginInteractive )
}
// A very precise test of the sequence of function calls generated by
// A very precise test of the sequence of function calls generated by
// ipnlocal.Local into its controlclient instance, and the events it
// ipnlocal.Local into its controlclient instance, and the events it
// produces upstream into the UI.
// produces upstream into the UI.
@ -385,7 +396,7 @@ func TestStateMachine(t *testing.T) {
// then wait for us to respond.
// then wait for us to respond.
t . Logf ( "\n\nLogin (noninteractive)" )
t . Logf ( "\n\nLogin (noninteractive)" )
notifies . expect ( 0 )
notifies . expect ( 0 )
b . Login( nil )
b . nonInteractive LoginForStateTest ( )
{
{
cc . assertCalls ( "Login" )
cc . assertCalls ( "Login" )
notifies . drain ( 0 )
notifies . drain ( 0 )
@ -666,7 +677,7 @@ func TestStateMachine(t *testing.T) {
c . Assert ( ipn . NeedsLogin , qt . Equals , b . State ( ) )
c . Assert ( ipn . NeedsLogin , qt . Equals , b . State ( ) )
}
}
b . Login( nil )
b . Start LoginInteractive ( )
t . Logf ( "\n\nLoginFinished3" )
t . Logf ( "\n\nLoginFinished3" )
notifies . expect ( 3 )
notifies . expect ( 3 )
cc . persist . UserProfile . LoginName = "user2"
cc . persist . UserProfile . LoginName = "user2"