From 1a06aabc735dab0591fa6b617961675c9d968727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= <1005065+DeepDiver1975@users.noreply.github.com> Date: Mon, 12 Feb 2024 12:45:39 +0100 Subject: [PATCH] fix: test --- .drone.star | 3 +- services/ccs/pkg/config/config.go | 36 +- services/ccs/pkg/service/v0/service.go | 2 +- services/ccs/pkg/storage/filesystem_caldav.go | 1 - tests/caldav/caldavtest/serverinfo.xml | 3 +- .../caldavtest/tests/CalDAV/caldavIOP.xml | 20 +- tests/caldav/serverinfo.xml | 873 ------------------ 7 files changed, 35 insertions(+), 903 deletions(-) delete mode 100644 tests/caldav/serverinfo.xml diff --git a/.drone.star b/.drone.star index d58d1220a79..6dfd8ead341 100644 --- a/.drone.star +++ b/.drone.star @@ -893,8 +893,9 @@ def ccsTests(storage): "environment": environment, "commands": [ "pwd", - "ls -l /app", "cd tests/caldav", + "ping ocis-server -c1", + "curl https://ocis-server:9200/dav/ -kv -ueinstein:relativity", "python3 /app/testcaldav.py --ssl --print-details-onfail --basedir caldavtest CalDAV/caldavIOP.xml", ], }] diff --git a/services/ccs/pkg/config/config.go b/services/ccs/pkg/config/config.go index 8d56eb1403a..66e1155ddba 100644 --- a/services/ccs/pkg/config/config.go +++ b/services/ccs/pkg/config/config.go @@ -16,14 +16,14 @@ type Config struct { HTTP HTTPConfig `yaml:"http"` Context context.Context `yaml:"-"` - JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;CALDAV_JWT_SECRET" desc:"The secret to mint and validate jwt tokens."` + JWTSecret string `yaml:"jwt_secret" env:"OCIS_JWT_SECRET;CCS_JWT_SECRET" desc:"The secret to mint and validate jwt tokens."` } type Log struct { - Level string `yaml:"level" env:"OCIS_LOG_LEVEL;CALDAV_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'."` - Pretty bool `yaml:"pretty" env:"OCIS_LOG_PRETTY;CALDAV_LOG_PRETTY" desc:"Activates pretty log output."` - Color bool `yaml:"color" env:"OCIS_LOG_COLOR;CALDAV_LOG_COLOR" desc:"Activates colorized log output."` - File string `yaml:"file" env:"OCIS_LOG_FILE;CALDAV_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set."` + Level string `yaml:"level" env:"OCIS_LOG_LEVEL;CCS_LOG_LEVEL" desc:"The log level. Valid values are: 'panic', 'fatal', 'error', 'warn', 'info', 'debug', 'trace'."` + Pretty bool `yaml:"pretty" env:"OCIS_LOG_PRETTY;CCS_LOG_PRETTY" desc:"Activates pretty log output."` + Color bool `yaml:"color" env:"OCIS_LOG_COLOR;CCS_LOG_COLOR" desc:"Activates colorized log output."` + File string `yaml:"file" env:"OCIS_LOG_FILE;CCS_LOG_FILE" desc:"The path to the log file. Activates logging to this file if set."` } type Service struct { @@ -31,28 +31,28 @@ type Service struct { } type Debug struct { - Addr string `yaml:"addr" env:"CALDAV_DEBUG_ADDR" desc:"Bind address of the debug server, where metrics, health, config and debug endpoints will be exposed."` - Token string `yaml:"token" env:"CALDAV_DEBUG_TOKEN" desc:"Token to secure the metrics endpoint."` - Pprof bool `yaml:"pprof" env:"CALDAV_DEBUG_PPROF" desc:"Enables pprof, which can be used for profiling."` - Zpages bool `yaml:"zpages" env:"CALDAV_DEBUG_ZPAGES" desc:"Enables zpages, which can be used for collecting and viewing in-memory traces."` + Addr string `yaml:"addr" env:"CCS_DEBUG_ADDR" desc:"Bind address of the debug server, where metrics, health, config and debug endpoints will be exposed."` + Token string `yaml:"token" env:"CCS_DEBUG_TOKEN" desc:"Token to secure the metrics endpoint."` + Pprof bool `yaml:"pprof" env:"CCS_DEBUG_PPROF" desc:"Enables pprof, which can be used for profiling."` + Zpages bool `yaml:"zpages" env:"CCS_DEBUG_ZPAGES" desc:"Enables zpages, which can be used for collecting and viewing in-memory traces."` } type HTTPConfig struct { - Addr string `yaml:"addr" env:"CALDAV_HTTP_ADDR" desc:"The bind address of the HTTP service."` + Addr string `yaml:"addr" env:"CCS_HTTP_ADDR" desc:"The bind address of the HTTP service."` Namespace string `yaml:"-"` - Root string `yaml:"root" env:"CALDAV_HTTP_ROOT" desc:"Subdirectory that serves as the root for this HTTP service."` + Root string `yaml:"root" env:"CCS_HTTP_ROOT" desc:"Subdirectory that serves as the root for this HTTP service."` TLS shared.HTTPServiceTLS `yaml:"tls"` - Protocol string `yaml:"protocol" env:"CALDAV_HTTP_PROTOCOL" desc:"The transport protocol of the HTTP service."` - Prefix string `yaml:"prefix" env:"CALDAV_HTTP_PREFIX" desc:"A URL path prefix for the handler."` + Protocol string `yaml:"protocol" env:"CCS_HTTP_PROTOCOL" desc:"The transport protocol of the HTTP service."` + Prefix string `yaml:"prefix" env:"CCS_HTTP_PREFIX" desc:"A URL path prefix for the handler."` CORS `yaml:"cors"` } // CORS defines the available cors configuration. type CORS struct { - AllowedOrigins []string `yaml:"allow_origins" env:"OCIS_CORS_ALLOW_ORIGINS;CALDAV_CORS_ALLOW_ORIGINS" desc:"A list of allowed CORS origins. See following chapter for more details: *Access-Control-Allow-Origin* at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin. See the Environment Variable Types description for more details."` - AllowedMethods []string `yaml:"allow_methods" env:"OCIS_CORS_ALLOW_METHODS;CALDAV_CORS_ALLOW_METHODS" desc:"A list of allowed CORS methods. See following chapter for more details: *Access-Control-Request-Method* at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Request-Method. See the Environment Variable Types description for more details."` - AllowedHeaders []string `yaml:"allow_headers" env:"OCIS_CORS_ALLOW_HEADERS;CALDAV_CORS_ALLOW_HEADERS" desc:"A list of allowed CORS headers. See following chapter for more details: *Access-Control-Request-Headers* at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Request-Headers. See the Environment Variable Types description for more details."` - AllowCredentials bool `yaml:"allow_credentials" env:"OCIS_CORS_ALLOW_CREDENTIALS;CALDAV_CORS_ALLOW_CREDENTIALS" desc:"Allow credentials for CORS.See following chapter for more details: *Access-Control-Allow-Credentials* at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials."` + AllowedOrigins []string `yaml:"allow_origins" env:"OCIS_CORS_ALLOW_ORIGINS;CCS_CORS_ALLOW_ORIGINS" desc:"A list of allowed CORS origins. See following chapter for more details: *Access-Control-Allow-Origin* at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin. See the Environment Variable Types description for more details."` + AllowedMethods []string `yaml:"allow_methods" env:"OCIS_CORS_ALLOW_METHODS;CCS_CORS_ALLOW_METHODS" desc:"A list of allowed CORS methods. See following chapter for more details: *Access-Control-Request-Method* at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Request-Method. See the Environment Variable Types description for more details."` + AllowedHeaders []string `yaml:"allow_headers" env:"OCIS_CORS_ALLOW_HEADERS;CCS_CORS_ALLOW_HEADERS" desc:"A list of allowed CORS headers. See following chapter for more details: *Access-Control-Request-Headers* at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Request-Headers. See the Environment Variable Types description for more details."` + AllowCredentials bool `yaml:"allow_credentials" env:"OCIS_CORS_ALLOW_CREDENTIALS;CCS_CORS_ALLOW_CREDENTIALS" desc:"Allow credentials for CORS.See following chapter for more details: *Access-Control-Allow-Credentials* at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials."` } // Status holds the configurable values for the status.php @@ -62,5 +62,5 @@ type Status struct { Product string ProductName string ProductVersion string - Edition string `yaml:"edition" env:"OCIS_EDITION;CALDAV_EDITION"` + Edition string `yaml:"edition" env:"OCIS_EDITION;CCS_EDITION"` } diff --git a/services/ccs/pkg/service/v0/service.go b/services/ccs/pkg/service/v0/service.go index be14961836e..7c5ce0d9776 100644 --- a/services/ccs/pkg/service/v0/service.go +++ b/services/ccs/pkg/service/v0/service.go @@ -41,7 +41,7 @@ func (u *groupwareHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest) } - var homeSets []webdav.BackendSuppliedHomeSet //nolint:typecheck + var homeSets []webdav.BackendSuppliedHomeSet if u.caldavBackend != nil { path, err := u.caldavBackend.CalendarHomeSetPath(r.Context()) if err != nil { diff --git a/services/ccs/pkg/storage/filesystem_caldav.go b/services/ccs/pkg/storage/filesystem_caldav.go index 58d80252211..25d30990d5a 100644 --- a/services/ccs/pkg/storage/filesystem_caldav.go +++ b/services/ccs/pkg/storage/filesystem_caldav.go @@ -30,7 +30,6 @@ func (b *filesystemBackend) CalendarHomeSetPath(ctx context.Context) (string, er } func (b *filesystemBackend) CreateCalendar(ctx context.Context, calendar *caldav.Calendar) error { - // TODO what should the default calendar look like? resourceName := path.Base(calendar.Path) localPath, err_ := b.localCalDAVDir(ctx, resourceName) if err_ != nil { diff --git a/tests/caldav/caldavtest/serverinfo.xml b/tests/caldav/caldavtest/serverinfo.xml index fa3cdcebc6a..84958beb2b5 100644 --- a/tests/caldav/caldavtest/serverinfo.xml +++ b/tests/caldav/caldavtest/serverinfo.xml @@ -19,7 +19,8 @@ --> - localhost + + ocis-server 9200 9200 basic diff --git a/tests/caldav/caldavtest/tests/CalDAV/caldavIOP.xml b/tests/caldav/caldavtest/tests/CalDAV/caldavIOP.xml index 13975fb4876..4f08a0228eb 100644 --- a/tests/caldav/caldavtest/tests/CalDAV/caldavIOP.xml +++ b/tests/caldav/caldavtest/tests/CalDAV/caldavIOP.xml @@ -64,7 +64,8 @@ - + + Create new single-instance meeting titled "Meeting 1.4" with an alarm set to trigger 15 minutes prior to the schedule time of the meeting. @@ -145,7 +146,8 @@ - + + Add an alarm to "Meeting 1.1bis". @@ -191,7 +193,8 @@ - + + Cancel the 4th instance of the recurring meeting created in 1.2. @@ -227,7 +230,8 @@ - + + diff --git a/tests/caldav/serverinfo.xml b/tests/caldav/serverinfo.xml deleted file mode 100644 index 84958beb2b5..00000000000 --- a/tests/caldav/serverinfo.xml +++ /dev/null @@ -1,873 +0,0 @@ - - - - - - - - - ocis-server - 9200 - 9200 - basic - - - 120 - 0.25 - 30 - - - - COPY Method - MOVE Method - Extended MKCOL - - - ACL Method - acl-principal-prop-set REPORT - principal-match REPORT - principal-property-search REPORT - principal-search-property-set REPORT - calendarserver-principal-search REPORT - - add-member - - brief - bulk-post - ctag - current-user-principal - directory listing - extended-principal-search - expand-property - only-proxy-groups - limits - own-root - prefer - prefer-minimal - prefer-representation - prefer-noroot - quota - - resource-id - sync-report - - - sync-report-config-token - well-known - - - - - json-data - - - control-api - - - caldav - attachments-collection - auto-accept - auto-accept-modes - client-fix-TRANSP - - default-alarms - EMAIL parameter - extended-freebusy - freebusy-url - group-attendee-expansion - implicit-scheduling - location-resource-tracking - managed-attachments - maskuid - no-duplicate-uids - partstat-timestamp - - private-comments - private-events - proxy - - recurrence-splitting - remove-duplicate-alarms - query-extended - shared-calendars - share-calendars-to-groups - schedule-changes - split-calendars - supported-component-sets - supported-component-sets-one - timerange-low-limit - timerange-high-limit - timezones-by-reference - timezone-service - timezone-std-service - - travel-time-busy - vavailability - - webcal - - - - - - - - - - - - - - $multistatus-response-prefix: - /{DAV:}multistatus/{DAV:}response - - - $multistatus-href-prefix: - /{DAV:}multistatus/{DAV:}response/{DAV:}href - - - $verify-response-prefix: - {DAV:}response/{DAV:}propstat/{DAV:}prop - - - $verify-property-prefix: - /{DAV:}multistatus/{DAV:}response/{DAV:}propstat/{DAV:}prop - - - $verify-bad-response: - /{DAV:}multistatus/{DAV:}response/{DAV:}status - - - $verify-error-response: - /{DAV:}multistatus/{DAV:}response/{DAV:}error - - - $CALDAV: - urn:ietf:params:xml:ns:caldav - - - $CARDDAV: - urn:ietf:params:xml:ns:carddav - - - $CS: - http://calendarserver.org/ns/ - - - - - - - - $root: - /dav/ - - - - - $principalcollection: - $root:principals/ - - - - - $uidstype: - __uids__ - - - $userstype: - users - - - $groupstype: - groups - - - $locationstype: - locations - - - $resourcestype: - resources - - - - - $principals_uids: - $principalcollection:$uidstype:/ - - - $principals_users: - $principalcollection:$userstype:/ - - - $principals_groups: - $principalcollection:$groupstype:/ - - - $principals_resources: - $principalcollection:$resourcestype:/ - - - $principals_locations: - $principalcollection:$locationstype:/ - - - - - $calendars: - $root:calendars/ - - - - - $calendars_uids: - $calendars:$uidstype:/ - - - $calendars_users: - $calendars:$userstype:/ - - - $calendars_resources: - $calendars:$resourcestype:/ - - - $calendars_locations: - $calendars:$locationstype:/ - - - - - $calendar: - calendar - - - - - $tasks: - tasks - - - - - $polls: - polls - - - - - $inbox: - inbox - - - - - $outbox: - outbox - - - - - $dropbox: - dropbox - - - - - $attachments: - dropbox - - - - - $notification: - notification - - - - - $freebusy: - freebusy - - - - - $calendar_home_items_initial_sync: - [-,$calendar:/,$tasks:/,$inbox:/,$outbox:/,$freebusy:,$notification:/] - - - - - $calendar_sync_extra_items: - [-] - - - - - $calendar_sync_extra_count: - 1 - - - - - $servertoserver: - $root:inbox - - - - - $timezoneservice: - $root:timezones - - - - - $timezonestdservice: - $root:stdtimezones - - - - - $addressbooks: - $root:addressbooks/ - - - - - $addressbooks_uids: - $addressbooks:$uidstype:/ - - - $addressbooks_users: - $addressbooks:$userstype:/ - - - - - $addressbook: - addressbook - - - - - $directory: - $root:directory/ - - - - - $add-member: - ;add-member - - - - - $useradmin: - admin - - - - $useradminguid: - 0C8BDE62-E600-4696-83D3-8B5ECABDFD2E - - - - $pswdadmin: - admin - - - - - $principal_admin: - $principals_users:$useradmin:/ - - - $principaluri_admin: - $principals_uids:$useradminguid:/ - - - - - $userapprentice: - apprentice - - - - $userapprenticeguid: - 29B6C503-11DF-43EC-8CCA-40C7003149CE - - - - $pswdapprentice: - apprentice - - - - - $principal_apprentice: - $principals_users:$userapprentice:/ - - - $principaluri_apprentice: - $principals_uids:$userapprenticeguid:/ - - - - - $userproxy: - superuser - - - - $pswdproxy: - superuser - - - - - - - $userid%d: - user%02d - - - - $userguid%d: - 10000000-0000-0000-0000-000000000%03d - - - - $username%d: - User %02d - - - - $username-encoded%d: - User%%20%02d - - - - $firstname%d: - User - - - - $lastname%d: - %02d - - - - $pswd%d: - user%02d - - - - $principal%d: - $principals_users:$userid%d:/ - - - $principaluri%d: - $principals_users:$userid%d:/ - - - $principal%dnoslash: - $principals_users:$userid%d: - - - - - $calendarhome%d: - $calendars:$userid%d: - - - - $calendarhomealt%d: - $calendars_users:$userid%d: - - - - $calendarpath%d: - $calendarhome%d:/$calendar: - - - - $calendarpathalt%d: - $calendarhomealt%d:/$calendar: - - - - $taskspath%d: - $calendarhome%d:/$tasks: - - - - $pollspath%d: - $calendarhome%d:/$polls: - - - - $inboxpath%d: - $calendarhome%d:/$inbox: - - - - $outboxpath%d: - $calendarhome%d:/$outbox: - - - - $dropboxpath%d: - $calendarhome%d:/$dropbox: - - - - $notificationpath%d: - $calendarhome%d:/$notification: - - - - $freebusypath%d: - $calendarhome%d:/$freebusy: - - - $email%d: - $userid%d:@example.com - - - - $cuaddr%d: - mailto:$email%d: - - - $cuaddralt%d: - $cuaddr%d: - - - $cuaddraltnoslash%d: - $cuaddr%d: - - - $cuaddrurn%d: - urn:x-uid:$userguid%d: - - - - - $addressbookhome%d: - $addressbooks:users/$userid%d: - - - - $addressbookpath%d: - $addressbookhome%d:/$addressbook: - - - - - - - - $publicuserid%d: - public%02d - - - - $publicuserguid%d: - 50000000-0000-0000-0000-0000000000%02d - - - - $publicusername%d: - Public %02d - - - - $publicpswd%d: - public%02d - - - - $publicprincipal%d: - $principals_users:$publicuserid%d:/ - - - $publicprincipaluri%d: - $principals_uids:$publicuserguid%d:/ - - - - $publiccalendarhome%d: - $calendars_uids:$publicuserguid%d: - - - - $publiccalendarpath%d: - $calendars_uids:$publicuserguid%d:/$calendar: - - - $publicemail%d: - $publicuserid%d:@example.com - - - - $publiccuaddr%d: - mailto:$publicemail%d: - - - $publiccuaddralt%d: - $publiccuaddr%d: - - - $publiccuaddrurn%d: - urn:x-uid:$publicuserguid%d: - - - - - - - $resourceid%d: - resource%02d - - - - $resourceguid%d: - 40000000-0000-0000-0000-000000000%03d - - - - $resourcename%d: - Resource %02d - - - - $rcalendarhome%d: - $calendars_uids:$resourceguid%d: - - - - $rcalendarpath%d: - $calendars_uids:$resourceguid%d:/$calendar: - - - - $rinboxpath%d: - $calendars_uids:$resourceguid%d:/$inbox: - - - - $routboxpath%d: - $calendars_uids:$resourceguid%d:/$outbox: - - - - $rprincipal%d: - $principals_resources:$resourceid%d:/ - - - $rprincipaluri%d: - $principals_uids:$resourceguid%d:/ - - - $rcuaddralt%d: - $rcuaddrurn%d: - - - $rcuaddrurn%d: - urn:x-uid:$resourceguid%d: - - - - - - - $locationid%d: - location%02d - - - - $locationguid%d: - 30000000-0000-0000-0000-000000000%03d - - - - $locationname%d: - Location %02d - - - - $lcalendarhome%d: - $calendars_uids:$locationguid%d: - - - - $lcalendarpath%d: - $calendars_uids:$locationguid%d:/$calendar: - - - - $linboxpath%d: - $calendars_uids:$locationguid%d:/$inbox: - - - - $loutboxpath%d: - $calendars_uids:$locationguid%d:/$outbox: - - - - $lprincipal%d: - $principals_resources:$locationid%d:/ - - - $lprincipaluri%d: - $principals_uids:$locationguid%d:/ - - - $lcuaddralt%d: - $lprincipaluri%d: - - - $lcuaddrurn%d: - urn:x-uid:$locationguid%d: - - - - - - - - $groupid%d: - group%02d - - - - $groupguid%d: - 20000000-0000-0000-0000-000000000%03d - - - - $groupname%d: - Group %02d - - - - $gprincipal%d: - $principals_resources:$groupid%d:/ - - - $gprincipaluri%d: - $principals_uids:$groupguid%d:/ - - - $gemail%d: - $groupid%d:@example.com - - - $gcuaddralt%d: - $gprincipaluri%d: - - - $gcuaddrurn%d: - urn:x-uid:$groupguid%d: - - - - - - $i18nid: - i18nuser - - - - $i18nguid: - 860B3EE9-6D7C-4296-9639-E6B998074A78 - - - - $i18nname: - まだ - - - - $i18npswd: - i18nuser - - - - $i18ncalendarpath: - $calendars_uids:$i18nguid:/$calendar: - - - $i18nemail: - $i18nid:@example.com - - - - $i18ncuaddr: - mailto:$i18nemail: - - - $i18ncuaddrurn: - urn:x-uid:$i18nguid: - - - - - $principaldisabled: - $principals_groups:disabledgroup/ - - - $principaluridisabled: - $principals_uids:disabledgroup/ - - - - $cuaddrdisabled: - $principals_uids:disabledgroup/ - - - - - - - $cuaddr2: - MAILTO:$email2: - - - - $userid1: - einstein - - - $pswd1: - relativity - - - - $userid2: - marie - - - $pswd2: - radioactivity - - - -