Skip to content

Commit

Permalink
fix tests after anonssh refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
stapelberg committed Apr 12, 2022
1 parent a408fe1 commit f3bbd08
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions internal/rsynctest/rsynctest.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,15 @@ func New(t *testing.T, modules []rsyncd.Module, opts ...Option) *TestServer {
ts.Port = port

if ts.listeners[0].AuthorizedSSH.Address != "" {
sshListener, err := anonssh.ListenerFromConfig(ts.listeners[0])
if err != nil {
t.Fatal(err)
}
cfg := &rsyncdconfig.Config{
Modules: modules,
}
go func() {
err := anonssh.Serve(ts.listener, ts.listeners[0].AuthorizedSSH.AuthorizedKeys, cfg, func(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) error {
err := anonssh.Serve(ts.listener, sshListener, cfg, func(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) error {
return maincmd.Main(context.Background(), args, stdin, stdout, stderr, cfg)
})

Expand All @@ -109,11 +113,15 @@ func New(t *testing.T, modules []rsyncd.Module, opts ...Option) *TestServer {
}
}()
} else if ts.listeners[0].AnonSSH != "" {
sshListener, err := anonssh.ListenerFromConfig(ts.listeners[0])
if err != nil {
t.Fatal(err)
}
cfg := &rsyncdconfig.Config{
Modules: modules,
}
go func() {
err := anonssh.Serve(ts.listener, "", cfg, func(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) error {
err := anonssh.Serve(ts.listener, sshListener, cfg, func(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) error {
return maincmd.Main(context.Background(), args, stdin, stdout, stderr, cfg)
})

Expand Down

0 comments on commit f3bbd08

Please sign in to comment.