Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75bd514858 | ||
|
|
7a8e4ee824 |
No files matched your search
@@ -1,5 +1,6 @@
|
||||
# Table of Contents
|
||||
|
||||
* [Changelog for 8.0.8](#changelog-for-808-2026-08-20)
|
||||
* [Changelog for 8.0.7](#changelog-for-807-2026-07-31)
|
||||
* [Changelog for 8.0.6](#changelog-for-806-2026-07-15)
|
||||
* [Changelog for 8.0.5](#changelog-for-805-2026-06-18)
|
||||
@@ -66,6 +67,60 @@
|
||||
* [Changelog for 1.1.0](#changelog-for-110-2021-01-22)
|
||||
* [Changelog for 1.0.0](#changelog-for-100-2020-12-17)
|
||||
|
||||
# Changelog for [8.0.8] (2026-08-20)
|
||||
|
||||
The following sections list the changes for 8.0.8.
|
||||
|
||||
[8.0.8]: https://github.com/owncloud/ocis/compare/v8.0.7...v8.0.8
|
||||
|
||||
## Summary
|
||||
|
||||
* Security - Bump golang.org/x/image to v0.45.0: [#12808](https://github.com/owncloud/ocis/pull/12808)
|
||||
* Bugfix - Cache LDAP instance mapper lookups: [#12823](https://github.com/owncloud/ocis/pull/12823)
|
||||
* Bugfix - Fix share metadata corruption during concurrent share operations: [#12621](https://github.com/owncloud/ocis/pull/12621)
|
||||
* Enhancement - Add TLS support for NATS store and registry connections: [#12765](https://github.com/owncloud/ocis/pull/12765)
|
||||
|
||||
## Details
|
||||
|
||||
* Security - Bump golang.org/x/image to v0.45.0: [#12808](https://github.com/owncloud/ocis/pull/12808)
|
||||
|
||||
Upgraded golang.org/x/image from v0.44.0 to v0.45.0 to address
|
||||
GO-2026-6222: excessive memory allocation during VP8L decoding.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/12808
|
||||
|
||||
* Bugfix - Cache LDAP instance mapper lookups: [#12823](https://github.com/owncloud/ocis/pull/12823)
|
||||
|
||||
In multi-instance deployments, resolving a user's instance name/ID during
|
||||
`GET /graph/v1.0/users` (and group member expansion) issued a fresh, uncached
|
||||
LDAP search per instance/guest attribute value on every request. Under load
|
||||
this multiplied into large numbers of redundant LDAP round-trips per page of
|
||||
users, saturating the LDAP connection pool and causing request timeouts. The
|
||||
LDAP identity backend now caches instance mapper lookups, including negative
|
||||
(not-found) results, for a configurable TTL
|
||||
(`OCIS_LDAP_INSTANCE_MAPPER_CACHE_TTL`, default 60s).
|
||||
|
||||
https://github.com/owncloud/ocis/pull/12823
|
||||
|
||||
* Bugfix - Fix share metadata corruption during concurrent share operations: [#12621](https://github.com/owncloud/ocis/pull/12621)
|
||||
|
||||
When multiple sharing service replicas processed share operations concurrently
|
||||
for the same user, the share metadata could become corrupted with references to
|
||||
missing data, making all shares inaccessible to that user. The received share
|
||||
cache now uses compare-and-swap (etag) validation to detect concurrent writes
|
||||
and retries gracefully, preventing metadata corruption.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/12621
|
||||
|
||||
* Enhancement - Add TLS support for NATS store and registry connections: [#12765](https://github.com/owncloud/ocis/pull/12765)
|
||||
|
||||
All `nats-js-kv` store, cache, and service registry connections now support
|
||||
TLS. Configure via `OCIS_CACHE_ENABLE_TLS`, `OCIS_PERSISTENT_STORE_ENABLE_TLS`,
|
||||
and `MICRO_REGISTRY_ENABLE_TLS`, with corresponding `*_TLS_INSECURE` and
|
||||
`*_TLS_ROOT_CA_CERTIFICATE` variants per connection type.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/12765
|
||||
|
||||
# Changelog for [8.0.7] (2026-07-31)
|
||||
|
||||
The following sections list the changes for 8.0.7.
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
Bugfix: Cache LDAP instance mapper lookups
|
||||
|
||||
In multi-instance deployments, resolving a user's instance name/ID during
|
||||
`GET /graph/v1.0/users` (and group member expansion) issued a fresh, uncached
|
||||
LDAP search per instance/guest attribute value on every request. Under load
|
||||
this multiplied into large numbers of redundant LDAP round-trips per page of
|
||||
users, saturating the LDAP connection pool and causing request timeouts. The
|
||||
LDAP identity backend now caches instance mapper lookups, including negative
|
||||
(not-found) results, for a configurable TTL
|
||||
(`OCIS_LDAP_INSTANCE_MAPPER_CACHE_TTL`, default 60s).
|
||||
|
||||
https://github.com/owncloud/ocis/pull/12823
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -16,7 +16,7 @@ var (
|
||||
// LatestTag is the latest released version plus the dev meta version.
|
||||
// Will be overwritten by the release pipeline
|
||||
// Needs a manual change for every tagged release
|
||||
LatestTag = "8.0.7"
|
||||
LatestTag = "8.0.8"
|
||||
|
||||
// Date indicates the build date.
|
||||
// This has been removed, it looks like you can only replace static strings with recent go versions
|
||||
|
||||
@@ -56,15 +56,15 @@ type Spaces struct {
|
||||
}
|
||||
|
||||
type LDAP struct {
|
||||
URI string `yaml:"uri" env:"OCIS_LDAP_URI;GRAPH_LDAP_URI" desc:"URI of the LDAP Server to connect to. Supported URI schemes are 'ldaps://' and 'ldap://'" introductionVersion:"pre5.0"`
|
||||
CACert string `yaml:"cacert" env:"OCIS_LDAP_CACERT;GRAPH_LDAP_CACERT" desc:"Path/File name for the root CA certificate (in PEM format) used to validate TLS server certificates of the LDAP service. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH/idm." introductionVersion:"pre5.0"`
|
||||
Insecure bool `yaml:"insecure" env:"OCIS_LDAP_INSECURE;GRAPH_LDAP_INSECURE" desc:"Disable TLS certificate validation for the LDAP connections. Do not set this in production environments." introductionVersion:"pre5.0"`
|
||||
BindDN string `yaml:"bind_dn" env:"OCIS_LDAP_BIND_DN;GRAPH_LDAP_BIND_DN" desc:"LDAP DN to use for simple bind authentication with the target LDAP server." introductionVersion:"pre5.0"`
|
||||
BindPassword string `yaml:"bind_password" env:"OCIS_LDAP_BIND_PASSWORD;GRAPH_LDAP_BIND_PASSWORD" desc:"Password to use for authenticating the 'bind_dn'." introductionVersion:"pre5.0"`
|
||||
UseServerUUID bool `yaml:"use_server_uuid" env:"GRAPH_LDAP_SERVER_UUID" desc:"If set to true, rely on the LDAP Server to generate a unique ID for users and groups, like when using 'entryUUID' as the user ID attribute." introductionVersion:"pre5.0"`
|
||||
UsePasswordModExOp bool `yaml:"use_password_modify_exop" env:"GRAPH_LDAP_SERVER_USE_PASSWORD_MODIFY_EXOP" desc:"Use the 'Password Modify Extended Operation' for updating user passwords." introductionVersion:"pre5.0"`
|
||||
WriteEnabled bool `yaml:"write_enabled" env:"OCIS_LDAP_SERVER_WRITE_ENABLED;GRAPH_LDAP_SERVER_WRITE_ENABLED" desc:"Allow creating, modifying and deleting LDAP users via the GRAPH API. This can only be set to 'true' when keeping default settings for the LDAP user and group attribute types (the 'OCIS_LDAP_USER_SCHEMA_* and 'OCIS_LDAP_GROUP_SCHEMA_* variables)." introductionVersion:"pre5.0"`
|
||||
UpdateUserLastSignInDate bool `yaml:"update_user_last_sign_in_date" env:"OCIS_LDAP_UPDATE_LAST_SIGNIN_DATE;GRAPH_LDAP_UPDATE_LAST_SIGNIN_DATE" desc:"Update the 'oCLastSignInTimestamp' LDAP attribute of a user when the user signs in. The attribute is only persisted when 'OCIS_LDAP_SERVER_WRITE_ENABLED' is also enabled. Set this to 'false' to avoid an LDAP write on every sign-in, e.g. when the last sign-in timestamp is not needed or the LDAP write load should be reduced." introductionVersion:"8.2.0"`
|
||||
URI string `yaml:"uri" env:"OCIS_LDAP_URI;GRAPH_LDAP_URI" desc:"URI of the LDAP Server to connect to. Supported URI schemes are 'ldaps://' and 'ldap://'" introductionVersion:"pre5.0"`
|
||||
CACert string `yaml:"cacert" env:"OCIS_LDAP_CACERT;GRAPH_LDAP_CACERT" desc:"Path/File name for the root CA certificate (in PEM format) used to validate TLS server certificates of the LDAP service. If not defined, the root directory derives from $OCIS_BASE_DATA_PATH/idm." introductionVersion:"pre5.0"`
|
||||
Insecure bool `yaml:"insecure" env:"OCIS_LDAP_INSECURE;GRAPH_LDAP_INSECURE" desc:"Disable TLS certificate validation for the LDAP connections. Do not set this in production environments." introductionVersion:"pre5.0"`
|
||||
BindDN string `yaml:"bind_dn" env:"OCIS_LDAP_BIND_DN;GRAPH_LDAP_BIND_DN" desc:"LDAP DN to use for simple bind authentication with the target LDAP server." introductionVersion:"pre5.0"`
|
||||
BindPassword string `yaml:"bind_password" env:"OCIS_LDAP_BIND_PASSWORD;GRAPH_LDAP_BIND_PASSWORD" desc:"Password to use for authenticating the 'bind_dn'." introductionVersion:"pre5.0"`
|
||||
UseServerUUID bool `yaml:"use_server_uuid" env:"GRAPH_LDAP_SERVER_UUID" desc:"If set to true, rely on the LDAP Server to generate a unique ID for users and groups, like when using 'entryUUID' as the user ID attribute." introductionVersion:"pre5.0"`
|
||||
UsePasswordModExOp bool `yaml:"use_password_modify_exop" env:"GRAPH_LDAP_SERVER_USE_PASSWORD_MODIFY_EXOP" desc:"Use the 'Password Modify Extended Operation' for updating user passwords." introductionVersion:"pre5.0"`
|
||||
WriteEnabled bool `yaml:"write_enabled" env:"OCIS_LDAP_SERVER_WRITE_ENABLED;GRAPH_LDAP_SERVER_WRITE_ENABLED" desc:"Allow creating, modifying and deleting LDAP users via the GRAPH API. This can only be set to 'true' when keeping default settings for the LDAP user and group attribute types (the 'OCIS_LDAP_USER_SCHEMA_* and 'OCIS_LDAP_GROUP_SCHEMA_* variables)." introductionVersion:"pre5.0"`
|
||||
UpdateUserLastSignInDate bool `yaml:"update_user_last_sign_in_date" env:"OCIS_LDAP_UPDATE_LAST_SIGNIN_DATE;GRAPH_LDAP_UPDATE_LAST_SIGNIN_DATE" desc:"Update the 'oCLastSignInTimestamp' LDAP attribute of a user when the user signs in. The attribute is only persisted when 'OCIS_LDAP_SERVER_WRITE_ENABLED' is also enabled. Set this to 'false' to avoid an LDAP write on every sign-in, e.g. when the last sign-in timestamp is not needed or the LDAP write load should be reduced." introductionVersion:"8.0.6"`
|
||||
RetryMaxCount int `yaml:"retry_max_count" env:"OCIS_LDAP_RETRY_MAX_COUNT;GRAPH_LDAP_RETRY_MAX_COUNT" desc:"Maximum number of retries for failed LDAP operations. Reads retry on transient and network errors; writes retry only when the connection failed before the request was sent (e.g. a reused idle connection found closed), so the request provably never reached the server and cannot be double-applied. Default 1." introductionVersion:"8.2.0"`
|
||||
RetryBaseDelay time.Duration `yaml:"retry_base_delay" env:"OCIS_LDAP_RETRY_BASE_DELAY;GRAPH_LDAP_RETRY_BASE_DELAY" desc:"Base delay for exponential backoff between LDAP retries (e.g. '100ms'). Set to 0 to disable backoff." introductionVersion:"8.2.0"`
|
||||
RetryMaxDelay time.Duration `yaml:"retry_max_delay" env:"OCIS_LDAP_RETRY_MAX_DELAY;GRAPH_LDAP_RETRY_MAX_DELAY" desc:"Maximum delay cap for exponential backoff between LDAP retries (e.g. '5s'). 0 (default) uses the library default cap of 60s." introductionVersion:"8.2.0"`
|
||||
@@ -115,6 +115,7 @@ type LDAP struct {
|
||||
InstanceMapperIDAttribute string `yaml:"instance_mapper_id_attribute" env:"OCIS_LDAP_INSTANCE_MAPPER_ID_ATTRIBUTE" desc:"LDAP Attribute of the instance ID. Requires OCIS_MULTI_INSTANCE_ENABLED." introductionVersion:"8.0.0"`
|
||||
CrossInstanceReferenceTemplate string `yaml:"cross_instance_reference_template" env:"OCIS_LDAP_CROSS_INSTANCE_REFERENCE_TEMPLATE" desc:"Template for the users unique reference across oCIS instances. Requires OCIS_MULTI_INSTANCE_ENABLED." introductionVersion:"8.0.0"`
|
||||
InstanceURLTemplate string `yaml:"instance_url_template" env:"OCIS_LDAP_INSTANCE_URL_TEMPLATE" desc:"Template for the instance URL. Requires OCIS_MULTI_INSTANCE_ENABLED." introductionVersion:"8.0.0"`
|
||||
InstanceMapperCacheTTL int `yaml:"instance_mapper_cache_ttl" env:"OCIS_LDAP_INSTANCE_MAPPER_CACHE_TTL" desc:"Max TTL in seconds for the LDAP instance mapper cache. Requires OCIS_MULTI_INSTANCE_ENABLED." introductionVersion:"8.0.0"`
|
||||
}
|
||||
|
||||
// LDAPEducationConfig represents the LDAP configuration for education related resources
|
||||
|
||||
@@ -118,6 +118,8 @@ func DefaultConfig() *config.Config {
|
||||
GroupMemberAttribute: "member",
|
||||
GroupIDAttribute: "owncloudUUID",
|
||||
EducationResourcesEnabled: false,
|
||||
// 1 minute
|
||||
InstanceMapperCacheTTL: 60,
|
||||
},
|
||||
},
|
||||
Cache: &config.Cache{
|
||||
@@ -218,4 +220,5 @@ func Sanitize(cfg *config.Config) {
|
||||
cfg.Spaces.ExtendedSpacePropertiesCacheTTL = cfg.Spaces.ExtendedSpacePropertiesCacheTTL * int(time.Second)
|
||||
cfg.Spaces.GroupsCacheTTL = cfg.Spaces.GroupsCacheTTL * int(time.Second)
|
||||
cfg.Spaces.UsersCacheTTL = cfg.Spaces.UsersCacheTTL * int(time.Second)
|
||||
cfg.Identity.LDAP.InstanceMapperCacheTTL = cfg.Identity.LDAP.InstanceMapperCacheTTL * int(time.Second)
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
backoff "github.com/cenkalti/backoff/v5"
|
||||
"github.com/go-ldap/ldap/v3"
|
||||
"github.com/google/uuid"
|
||||
"github.com/jellydator/ttlcache/v3"
|
||||
"github.com/libregraph/idm/pkg/ldapdn"
|
||||
libregraph "github.com/owncloud/libre-graph-api-go"
|
||||
|
||||
@@ -69,14 +70,14 @@ type LDAP struct {
|
||||
disableUserMechanism DisableUserMechanismType
|
||||
localUserDisableGroupDN string
|
||||
|
||||
groupBaseDN string
|
||||
groupCreateBaseDN string
|
||||
groupFilter string
|
||||
groupObjectClass string
|
||||
groupAdditionalObjectClasses []string
|
||||
groupIDisOctetString bool
|
||||
groupScope int
|
||||
groupAttributeMap groupAttributeMap
|
||||
groupBaseDN string
|
||||
groupCreateBaseDN string
|
||||
groupFilter string
|
||||
groupObjectClass string
|
||||
groupAdditionalObjectClasses []string
|
||||
groupIDisOctetString bool
|
||||
groupScope int
|
||||
groupAttributeMap groupAttributeMap
|
||||
|
||||
educationConfig educationConfig
|
||||
|
||||
@@ -94,8 +95,19 @@ type LDAP struct {
|
||||
instanceMapperIDAttribute string
|
||||
crossInstanceReferenceTemplate *template.Template
|
||||
instanceURLTemplate *template.Template
|
||||
instanceCache *ttlcache.Cache[string, string]
|
||||
}
|
||||
|
||||
// instanceCacheKeySep separates the fields of an instanceCache key. A NUL byte can't
|
||||
// appear in an LDAP attribute name or search value, so it can't cause key collisions
|
||||
// between different (searchAttribute, resultAttribute, searchValue) triples.
|
||||
const instanceCacheKeySep = "\x00"
|
||||
|
||||
// instanceCacheNotFound is stored in instanceCache to negatively cache a lookup
|
||||
// that resolved to ErrNotFound, so repeatedly requested stale instance references
|
||||
// don't cost a fresh LDAP round-trip on every call.
|
||||
const instanceCacheNotFound = instanceCacheKeySep + "not-found"
|
||||
|
||||
type userAttributeMap struct {
|
||||
displayName string
|
||||
id string
|
||||
@@ -205,6 +217,12 @@ func NewLDAPBackend(lc ldap.Client, config config.LDAP, logger *log.Logger, inst
|
||||
}
|
||||
}
|
||||
|
||||
instanceCache := ttlcache.New(
|
||||
ttlcache.WithTTL[string, string](time.Duration(config.InstanceMapperCacheTTL)),
|
||||
ttlcache.WithDisableTouchOnHit[string, string](),
|
||||
)
|
||||
go instanceCache.Start()
|
||||
|
||||
return &LDAP{
|
||||
useServerUUID: config.UseServerUUID,
|
||||
usePwModifyExOp: config.UsePasswordModExOp,
|
||||
@@ -241,6 +259,7 @@ func NewLDAPBackend(lc ldap.Client, config config.LDAP, logger *log.Logger, inst
|
||||
instanceMapperIDAttribute: config.InstanceMapperIDAttribute,
|
||||
crossInstanceReferenceTemplate: crossInstanceReferenceTemplate,
|
||||
instanceURLTemplate: instanceURLTemplate,
|
||||
instanceCache: instanceCache,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -1604,6 +1623,14 @@ func (i *LDAP) getInstance(searchValue, searchAttribute, resultAttribute string)
|
||||
return searchValue, nil
|
||||
}
|
||||
|
||||
cacheKey := searchAttribute + instanceCacheKeySep + resultAttribute + instanceCacheKeySep + searchValue
|
||||
if item := i.instanceCache.Get(cacheKey); item != nil {
|
||||
if item.Value() == instanceCacheNotFound {
|
||||
return "", ErrNotFound
|
||||
}
|
||||
return item.Value(), nil
|
||||
}
|
||||
|
||||
searchRequest := ldap.NewSearchRequest(
|
||||
i.instanceMapperBaseDN,
|
||||
ldap.ScopeWholeSubtree,
|
||||
@@ -1615,23 +1642,30 @@ func (i *LDAP) getInstance(searchValue, searchAttribute, resultAttribute string)
|
||||
|
||||
res, err := i.conn.Search(searchRequest)
|
||||
if err != nil {
|
||||
// Not cached: this is a transient LDAP failure, not a definitive answer.
|
||||
i.logger.Error().Err(err).Str("backend", "ldap").Str("dn", i.instanceMapperBaseDN).Str("searchValue", searchValue).Str("searchAttribute", searchAttribute).Str("resultAttribute", resultAttribute).Msg("Search instance failed")
|
||||
return "", errorcode.New(errorcode.ItemNotFound, "instanceid search failed")
|
||||
}
|
||||
if len(res.Entries) == 0 {
|
||||
// expected behaviour - we log debug in case something is fishy. This log can be removed when the feature proves stable
|
||||
i.logger.Debug().Str("backend", "ldap").Str("dn", i.instanceMapperBaseDN).Str("searchValue", searchValue).Interface("result", res).Msg("Search instance empty")
|
||||
i.instanceCache.Set(cacheKey, instanceCacheNotFound, ttlcache.DefaultTTL)
|
||||
return "", ErrNotFound
|
||||
}
|
||||
if len(res.Entries) > 1 {
|
||||
// Not cached: ambiguous data, don't freeze it in.
|
||||
i.logger.Error().Str("backend", "ldap").Str("dn", i.instanceMapperBaseDN).Str("searchValue", searchValue).Interface("result", res).Msg("Search instance returned multiple responses.")
|
||||
return "", errorcode.New(errorcode.ItemNotFound, "instanceid search returned multiple responses")
|
||||
}
|
||||
if len(res.Entries[0].Attributes) == 0 || len(res.Entries[0].Attributes[0].Values) == 0 {
|
||||
// Not cached: malformed data, don't freeze it in.
|
||||
i.logger.Error().Str("backend", "ldap").Str("dn", i.instanceMapperBaseDN).Str("searchValue", searchValue).Interface("result", res).Msg("Search instance returned malformed response")
|
||||
return "", errorcode.New(errorcode.ItemNotFound, "instanceid search response malformed")
|
||||
}
|
||||
return res.Entries[0].Attributes[0].Values[0], nil
|
||||
|
||||
value := res.Entries[0].Attributes[0].Values[0]
|
||||
i.instanceCache.Set(cacheKey, value, ttlcache.DefaultTTL)
|
||||
return value, nil
|
||||
}
|
||||
|
||||
func (i *LDAP) getInstanceID(instancename string) (string, error) {
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package identity
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/go-ldap/ldap/v3"
|
||||
"github.com/owncloud/ocis/v2/services/graph/pkg/config"
|
||||
"github.com/owncloud/ocis/v2/services/graph/pkg/identity/mocks"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
var instanceMapperConfig = config.LDAP{
|
||||
UserBaseDN: "ou=people,dc=test",
|
||||
UserObjectClass: "inetOrgPerson",
|
||||
UserSearchScope: "sub",
|
||||
UserDisplayNameAttribute: "displayname",
|
||||
UserIDAttribute: "entryUUID",
|
||||
UserEmailAttribute: "mail",
|
||||
UserNameAttribute: "uid",
|
||||
|
||||
GroupBaseDN: "ou=groups,dc=test",
|
||||
GroupObjectClass: "groupOfNames",
|
||||
GroupSearchScope: "sub",
|
||||
GroupNameAttribute: "cn",
|
||||
GroupMemberAttribute: "member",
|
||||
GroupIDAttribute: "entryUUID",
|
||||
|
||||
InstanceMapperEnabled: true,
|
||||
InstanceMapperBaseDN: "ou=instances,dc=test",
|
||||
InstanceMapperNameAttribute: "instanceName",
|
||||
InstanceMapperIDAttribute: "instanceID",
|
||||
}
|
||||
|
||||
func TestGetInstanceNameIsCached(t *testing.T) {
|
||||
lm := &mocks.Client{}
|
||||
b, err := getMockedBackend(lm, instanceMapperConfig, &logger)
|
||||
assert.Nil(t, err)
|
||||
|
||||
instanceEntry := ldap.NewEntry("instanceID=instance-1,ou=instances,dc=test",
|
||||
map[string][]string{
|
||||
"instanceName": {"Instance One"},
|
||||
})
|
||||
lm.On("Search", mock.Anything).
|
||||
Return(&ldap.SearchResult{Entries: []*ldap.Entry{instanceEntry}}, nil)
|
||||
|
||||
name1, err1 := b.getInstanceName("instance-1")
|
||||
assert.Nil(t, err1)
|
||||
assert.Equal(t, "Instance One", name1)
|
||||
|
||||
name2, err2 := b.getInstanceName("instance-1")
|
||||
assert.Nil(t, err2)
|
||||
assert.Equal(t, "Instance One", name2)
|
||||
|
||||
lm.AssertNumberOfCalls(t, "Search", 1)
|
||||
}
|
||||
|
||||
func TestGetInstanceNameCachesNotFound(t *testing.T) {
|
||||
lm := &mocks.Client{}
|
||||
b, err := getMockedBackend(lm, instanceMapperConfig, &logger)
|
||||
assert.Nil(t, err)
|
||||
|
||||
lm.On("Search", mock.Anything).
|
||||
Return(&ldap.SearchResult{Entries: []*ldap.Entry{}}, nil)
|
||||
|
||||
_, err1 := b.getInstanceName("stale-instance")
|
||||
assert.ErrorIs(t, err1, ErrNotFound)
|
||||
|
||||
_, err2 := b.getInstanceName("stale-instance")
|
||||
assert.ErrorIs(t, err2, ErrNotFound)
|
||||
|
||||
lm.AssertNumberOfCalls(t, "Search", 1)
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
sonar.projectKey=owncloud_ocis
|
||||
sonar.organization=owncloud-1
|
||||
sonar.projectName=ocis
|
||||
sonar.projectVersion=8.0.7
|
||||
sonar.projectVersion=8.0.8
|
||||
sonar.host.url=https://sonarcloud.io
|
||||
|
||||
# =====================================================
|
||||
|
||||
Reference in new issue
Block a user