Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepDiver1975 committed Feb 12, 2024
1 parent 2f77c3c commit 1a06aab
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 903 deletions.
3 changes: 2 additions & 1 deletion .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
}]
Expand Down
36 changes: 18 additions & 18 deletions services/ccs/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,43 +16,43 @@ 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 {
Name string `yaml:"-"`
}

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
Expand All @@ -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"`
}
2 changes: 1 addition & 1 deletion services/ccs/pkg/service/v0/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion services/ccs/pkg/storage/filesystem_caldav.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion tests/caldav/caldavtest/serverinfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
-->

<serverinfo>
<host>localhost</host>
<!-- for local testing change this - ocis-server is used for drone ci -->
<host>ocis-server</host>
<nonsslport>9200</nonsslport>
<sslport>9200</sslport>
<authtype>basic</authtype>
Expand Down
20 changes: 12 additions & 8 deletions tests/caldav/caldavtest/tests/CalDAV/caldavIOP.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
</verify>
</request>
</test>
<test name='1.3'>
<!-- CalDAV Scheduling is not yet supported -->
<!-- test name='1.3'>
<description>Create new single-instance meeting titled "Meeting 1.3" with 2 other attendees.</description>
<request end-delete='yes'>
<method>PUT</method>
Expand All @@ -85,7 +86,7 @@
<method>WAITDELETEALL 1</method>
<ruri>$inboxpath3:/</ruri>
</request>
</test>
</test -->
<test name='1.4'>
<description>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.</description>
<request end-delete='yes'>
Expand Down Expand Up @@ -145,7 +146,8 @@
</verify>
</request>
</test>
<test name='2.4'>
<!-- CalDAV Scheduling is not yet supported -->
<!-- test name='2.4'>
<description>Add an attendee to "Meeting 1.1bis".</description>
<request>
<method>PUT</method>
Expand All @@ -162,7 +164,7 @@
<method>WAITDELETEALL 1</method>
<ruri>$inboxpath2:/</ruri>
</request>
</test>
</test -->
<test name='2.5'>
<description>Add an alarm to "Meeting 1.1bis".</description>
<request>
Expand Down Expand Up @@ -191,7 +193,8 @@
</verify>
</request>
</test>
<test name='2.7'>
<!-- CalDAV Scheduling is not yet supported -->
<!-- test name='2.7'>
<description>Modify the participation status of 1st instance to DECLINED.</description>
<request>
<method>PUT</method>
Expand All @@ -212,7 +215,7 @@
<method>WAITDELETEALL 1</method>
<ruri>$inboxpath3:/</ruri>
</request>
</test>
</test -->
<test name='2.8'>
<description>Cancel the 4th instance of the recurring meeting created in 1.2.</description>
<request>
Expand All @@ -227,7 +230,8 @@
</verify>
</request>
</test>
<test name='2.9'>
<!-- CalDAV Scheduling is not yet supported -->
<!-- test name='2.9'>
<description>One client changes "Meeting 1.1bis" to a different time, second client 'refreshes' its display to see the modification.</description>
<request end-delete='yes'>
<method>PUT</method>
Expand All @@ -244,7 +248,7 @@
<method>WAITDELETEALL 1</method>
<ruri>$inboxpath2:/</ruri>
</request>
</test>
</test -->
</test-suite>

<test-suite name='4. Event Deletion'>
Expand Down
Loading

0 comments on commit 1a06aab

Please sign in to comment.