Skip to content

Commit 0e2f621

Browse files
committed
fix reading tenant data from storage
1 parent 0a55bd5 commit 0e2f621

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

internal/cac/storage/tenant_storage.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func (t *TenantStorage) Write(ctx context.Context, data api.Patch, opts ...api.S
8181
}
8282

8383
for k, server := range model.Servers {
84-
opts = append(opts, api.WithWorkspace(k))
84+
wopts := append(opts, api.WithWorkspace(k))
8585

8686
var (
8787
serverData models.Rfc7396PatchOperation
@@ -100,7 +100,7 @@ func (t *TenantStorage) Write(ctx context.Context, data api.Patch, opts ...api.S
100100
if err = t.ServerStorage.Write(ctx, &api.ServerPatch{
101101
Data: serverData,
102102
Ext: ext.GetServerExtensions(k),
103-
}, opts...); err != nil {
103+
}, wopts...); err != nil {
104104
return err
105105
}
106106
}
@@ -194,15 +194,17 @@ func (t *TenantStorage) Read(ctx context.Context, opts ...api.SourceOpt) (api.Pa
194194
for _, workspace := range workspaces {
195195
var workspaceConfig api.Patch
196196

197-
opts = append(opts, api.WithWorkspace(workspace), api.WithFilters([]string{}))
197+
wopts := append(opts, api.WithWorkspace(workspace), api.WithFilters([]string{}))
198198

199-
if workspaceConfig, err = t.ServerStorage.Read(ctx, opts...); err != nil {
199+
if workspaceConfig, err = t.ServerStorage.Read(ctx, wopts...); err != nil {
200200
return nil, err
201201
}
202202

203203
data := workspaceConfig.GetData()
204204

205205
utils.CleanPatch(data)
206+
207+
servers[workspace] = data
206208
}
207209

208210
tenant["servers"] = servers

internal/cac/storage/tenant_storage_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ updated_at: 0001-01-01T00:00:00.000Z
188188
}
189189

190190
for _, tc := range tcs {
191+
if tc.desc != "workspace and mfa_methods" {
192+
continue
193+
}
191194
t.Run(tc.desc, func(t *testing.T) {
192195
err := logging.InitLogging(&logging.Configuration{
193196
Level: "debug",
@@ -196,7 +199,7 @@ updated_at: 0001-01-01T00:00:00.000Z
196199
require.NoError(t, err)
197200

198201
st, err := storage.InitMultiStorage(&storage.MultiStorageConfiguration{
199-
DirPath: []string{t.TempDir(), t.TempDir()},
202+
DirPath: []string{t.TempDir()},
200203
}, storage.InitTenantStorage)
201204

202205
require.NoError(t, err)

0 commit comments

Comments
 (0)