Debian Codegraph @

internal/rsyncdconfig/config_test.go

raw symbols SCIP
1 package rsyncdconfig_testscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig_test`/
2
3 import (
4 "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/"
5
6 "github.com/gokrazy/rsync/internal/rsyncdconfigscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/"
7 "github.com/gokrazy/rsync/rsyncdscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/rsyncd`/"
8 "github.com/google/go-cmp/cmpscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/"
9 )
10
11 func TestConfigscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig_test`/TestConfig().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
12 cfg, err := rsyncdconfigscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/.FromStringscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/FromString().(`
13 [[listener]]
14 rsyncd = "localhost:873"
15
16 [[listener]]
17 http_monitoring = "localhost:8738"
18
19 [[listener]]
20 anon_ssh = "localhost:22873"
21
22 [[module]]
23 name = "interop"
24 path = "/non/existant/path"
25
26 `)
27 if err != nil {
28 t.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().(err)
29 }
30
31 if got, want := len(cfg.Listenersscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/Config#Listeners.), 3; got != want {
32 t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("unexpected number of listeners: got %d, want %d", got, want)
33 }
34
35 {
36 want := []rsyncdconfigscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/.Listenerscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/Listener#{
37 {Rsyncdscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/Listener#Rsyncd.: "localhost:873"},
38 {HTTPMonitoringscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/Listener#HTTPMonitoring.: "localhost:8738"},
39 {AnonSSHscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/Listener#AnonSSH.: "localhost:22873"},
40 }
41 if diff := cmpscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/.Diffscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/Diff().(want, cfg.Listenersscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/Config#Listeners.); diff != "" {
42 t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("unexpected listener config: diff (-want +got):\n%s", diff)
43 }
44 }
45
46 {
47 want := []rsyncdscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/rsyncd`/.Modulescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/rsyncd`/Module#{
48 {Namescip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/rsyncd`/Module#Name.: "interop", Pathscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/rsyncd`/Module#Path.: "/non/existant/path"},
49 }
50 if diff := cmpscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/.Diffscip-go gomod github.com/google/go-cmp v0.7.0 `github.com/google/go-cmp/cmp`/Diff().(want, cfg.Modulesscip-go gomod github.com/gokrazy/rsync . `github.com/gokrazy/rsync/internal/rsyncdconfig`/Config#Modules.); diff != "" {
51 t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("unexpected module config: diff (-want +got):\n%s", diff)
52 }
53 }
54 }