feat: sync deployed v1.0.0-rc.38-custom.42
Sync production source including routing, billing, Astra detection and public uptime. Update custom build instructions and license packaging.
This commit is contained in:
1 parent
aa6c3f50f4
commit
ceddfd3d6b
828 files changed
+122253
-13702
No files matched your search
@@ -56,3 +56,27 @@ func identityFilters(key string, channelTypes []int) []dto.ChannelFilter {
|
||||
TaskPluginChannelTypes: channelTypes,
|
||||
}}
|
||||
}
|
||||
|
||||
func TestSharedPluginKeysFilterBothChannelSources(t *testing.T) {
|
||||
truncateTables(t)
|
||||
originalMemoryCache := common.MemoryCacheEnabled
|
||||
common.MemoryCacheEnabled = true
|
||||
t.Cleanup(func() { common.MemoryCacheEnabled = originalMemoryCache; InitChannelCache() })
|
||||
filters := []dto.ChannelFilter{{Kind: dto.FilterTaskPluginIdentity, TaskPluginKey: "alpha", TaskPluginKeys: []string{"alpha", "beta"}}}
|
||||
var abilities []Ability
|
||||
for index, key := range []string{"alpha", "beta", "unrelated"} {
|
||||
setting := `{"task_plugin_key":"` + key + `"}`
|
||||
channel := Channel{Id: 910001 + index, Type: constant.ChannelTypeTaskPlugin, Status: common.ChannelStatusEnabled, Name: key, Models: "shared", Group: "default", Setting: &setting}
|
||||
require.NoError(t, channel.Insert())
|
||||
abilities = append(abilities, Ability{ChannelId: channel.Id, Model: "shared", Group: "default", Enabled: true})
|
||||
matches, _ := ChannelSatisfiesFilters(&channel, "shared", filters)
|
||||
assert.Equal(t, index < 2, matches)
|
||||
}
|
||||
assert.Equal(t, abilities[:2], filterAbilitiesByConstraints(abilities, "shared", filters))
|
||||
InitChannelCache()
|
||||
channelSyncLock.RLock()
|
||||
kept, emptied := filterCandidateIDs([]int{910001, 910002, 910003}, "shared", filters)
|
||||
channelSyncLock.RUnlock()
|
||||
assert.Equal(t, []int{910001, 910002}, kept)
|
||||
assert.Empty(t, emptied)
|
||||
}
|
||||
Reference in new issue
Block a user