oss port (#12755)
This commit is contained in:
parent
55e195f161
commit
b9fde1dd6f
|
@ -141,3 +141,40 @@ func TestPathManager_HasExactPath(t *testing.T) {
|
|||
t.Fatalf("removing all paths did not clear manager: paths %v", m.Paths())
|
||||
}
|
||||
}
|
||||
|
||||
func TestPathManager_HasPath(t *testing.T) {
|
||||
m := New()
|
||||
|
||||
m.AddPaths([]string{"a/b/c/"})
|
||||
if m.HasPath("a/") {
|
||||
t.Fatal("should not have path 'a/'")
|
||||
}
|
||||
if m.HasPath("a/b/") {
|
||||
t.Fatal("should not have path 'a/b/'")
|
||||
}
|
||||
if !m.HasPath("a/b/c/") {
|
||||
t.Fatal("should have path 'a/b/c'")
|
||||
}
|
||||
|
||||
m.AddPaths([]string{"a/"})
|
||||
if !m.HasPath("a/") {
|
||||
t.Fatal("should have path 'a/'")
|
||||
}
|
||||
if !m.HasPath("a/b/") {
|
||||
t.Fatal("should have path 'a/b/'")
|
||||
}
|
||||
if !m.HasPath("a/b/c/") {
|
||||
t.Fatal("should have path 'a/b/c'")
|
||||
}
|
||||
|
||||
m.RemovePaths([]string{"a/"})
|
||||
if m.HasPath("a/") {
|
||||
t.Fatal("should not have path 'a/'")
|
||||
}
|
||||
if m.HasPath("a/b/") {
|
||||
t.Fatal("should not have path 'a/b/'")
|
||||
}
|
||||
if !m.HasPath("a/b/c/") {
|
||||
t.Fatal("should have path 'a/b/c'")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,6 +103,7 @@ var (
|
|||
enterprisePreSeal = enterprisePreSealImpl
|
||||
enterpriseSetupFilteredPaths = enterpriseSetupFilteredPathsImpl
|
||||
enterpriseSetupQuotas = enterpriseSetupQuotasImpl
|
||||
enterpriseSetupAPILock = setupAPILockImpl
|
||||
startReplication = startReplicationImpl
|
||||
stopReplication = stopReplicationImpl
|
||||
LastWAL = lastWALImpl
|
||||
|
@ -1967,6 +1968,7 @@ func (s standardUnsealStrategy) unseal(ctx context.Context, logger log.Logger, c
|
|||
if err := c.setupMounts(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
enterpriseSetupAPILock(c)
|
||||
if err := c.setupPolicyStore(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -2209,6 +2211,8 @@ func stopReplicationImpl(c *Core) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func setupAPILockImpl(c *Core) {}
|
||||
|
||||
func (c *Core) ReplicationState() consts.ReplicationState {
|
||||
return consts.ReplicationState(atomic.LoadUint32(c.replicationState))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue