Skip to content

Commit

Permalink
Ensure that the WindowsDesktopReady event is emitted
Browse files Browse the repository at this point in the history
When desktop access is enabled, the TeleportReady event will not
be emitted until the WindowsDesktopReadyEvent is emitted, and it
turns out we have *never* emitted a WindowsDesktopReadyEvent.

This is likely due to desktop access being copied from kube access
since the very beginning. The same issue was recently fixed for
kube access in #9418.
  • Loading branch information
zmb3 committed Jul 25, 2022
1 parent 4a79875 commit 0fed44f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
14 changes: 14 additions & 0 deletions integration/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1754,6 +1754,20 @@ func enableKubernetesService(t *testing.T, config *service.Config) {
require.NoError(t, enableKube(config, "teleport-cluster"))
}

func enableDesktopService(config *service.Config) {
// This config won't actually work, because there is no LDAP server,
// but it's enough to force desktop service to run.
config.WindowsDesktop.Enabled = true
config.WindowsDesktop.ListenAddr = *utils.MustParseAddr("127.0.0.1:0")
config.WindowsDesktop.Discovery.BaseDN = ""
config.WindowsDesktop.LDAP = service.LDAPConfig{
Domain: "example.com",
Addr: "127.0.0.1:636",
Username: "test",
InsecureSkipVerify: true,
}
}

func enableKube(config *service.Config, clusterName string) error {
kubeConfigPath := config.Kube.KubeconfigPath
if kubeConfigPath == "" {
Expand Down
4 changes: 2 additions & 2 deletions integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3933,9 +3933,9 @@ func testRotateSuccess(t *testing.T, suite *integrationTestSuite) {
config, err := teleport.GenerateConfig(t, nil, tconf)
require.NoError(t, err)

// Enable Kubernetes service to test issue where the `KubernetesReady` event was not properly propagated
// and in the case where Kube service was enabled cert rotation flow was broken.
// Enable Kubernetes/Desktop services to test that the ready event is propagated.
enableKubernetesService(t, config)
enableDesktopService(config)

serviceC := make(chan *service.TeleportProcess, 20)

Expand Down
1 change: 1 addition & 0 deletions lib/service/desktop.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ func (process *TeleportProcess) initWindowsDesktopServiceRegistered(log *logrus.
"Windows desktop service %s:%s is starting on %v.",
teleport.Version, teleport.Gitref, listener.Addr())
}
process.BroadcastEvent(Event{Name: WindowsDesktopReady, Payload: nil})
err := srv.Serve(listener)
if err != nil {
if err == http.ErrServerClosed {
Expand Down

0 comments on commit 0fed44f

Please sign in to comment.