diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-12-12 14:11:22 +0100 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-12-12 14:14:34 +0100 |
commit | c5af9792973ec10eb37a7e4f47e8a16e95c62f60 (patch) | |
tree | b8e98d2ad89bdff94652ee04c8a36617aacfabc2 /pkg/config/config_test.go | |
parent | c6bdde9c63758cb9b61c7a5559dd30d141aee289 (diff) | |
download | cerrado-c5af9792973ec10eb37a7e4f47e8a16e95c62f60.tar.gz cerrado-c5af9792973ec10eb37a7e4f47e8a16e95c62f60.tar.bz2 cerrado-c5af9792973ec10eb37a7e4f47e8a16e95c62f60.zip |
feat: Allow multiples scan configuration
Now it allow to register multiples scan configuration
Diffstat (limited to 'pkg/config/config_test.go')
-rw-r--r-- | pkg/config/config_test.go | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index 9080351..cc58ce9 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -18,9 +18,11 @@ func TestFileParsing(t *testing.T) { name: "minimal scan", config: `scan "/srv/git"`, expectedConfig: &configuration{ - Scan: &scan{ - Public: false, - Path: "/srv/git", + Scans: []*scan{ + { + Public: false, + Path: "/srv/git", + }, }, ListenAddr: defaultAddr(), Repositories: []*GitRepositoryConfiguration{}, @@ -33,9 +35,11 @@ scan "/srv/git" { public true }`, expectedConfig: &configuration{ - Scan: &scan{ - Public: true, - Path: "/srv/git", + Scans: []*scan{ + { + Public: true, + Path: "/srv/git", + }, }, ListenAddr: defaultAddr(), Repositories: []*GitRepositoryConfiguration{}, @@ -45,7 +49,7 @@ scan "/srv/git" { name: "minimal repository", config: `repository /srv/git/cerrado.git`, expectedConfig: &configuration{ - Scan: defaultScan(), + Scans: defaultScans(), ListenAddr: defaultAddr(), Repositories: []*GitRepositoryConfiguration{ { @@ -68,7 +72,7 @@ repository /srv/git/cerrado.git { about readme.txt }`, expectedConfig: &configuration{ - Scan: defaultScan(), + Scans: defaultScans(), ListenAddr: defaultAddr(), Repositories: []*GitRepositoryConfiguration{ { @@ -85,7 +89,7 @@ repository /srv/git/cerrado.git { name: "minimal listen", config: ``, expectedConfig: &configuration{ - Scan: defaultScan(), + Scans: defaultScans(), ListenAddr: defaultAddr(), Repositories: []*GitRepositoryConfiguration{}, }, @@ -94,7 +98,7 @@ repository /srv/git/cerrado.git { name: "complete listen", config: `listen-addr unix://var/run/cerrado/cerrado.sock`, expectedConfig: &configuration{ - Scan: defaultScan(), + Scans: defaultScans(), ListenAddr: "unix://var/run/cerrado/cerrado.sock", Repositories: []*GitRepositoryConfiguration{}, }, @@ -120,9 +124,11 @@ repository /srv/git/cerrado.git { about readme.txt }`, expectedConfig: &configuration{ - Scan: &scan{ - Public: true, - Path: "/srv/git", + Scans: []*scan{ + { + Public: true, + Path: "/srv/git", + }, }, ListenAddr: "unix://var/run/cerrado/cerrado.sock", Passphrase: "$2a$14$VnB/ZcB1DUDkMnosRA6Y7.dj8h5eroslDxTeXlLwfQX/x86mh6WAq", |