mirror of
https://github.com/gravitational/teleport.git
synced 2026-10-12 02:15:01 +00:00
This commits deperecates GetInstallers, which should be replaced by a paginated counterpart: ListInstallers A new stream helper `MergeStreamsWithPriority` is added which can be used to resolve clashing compare keys in two streams. Towards: gravitational/teleport.e/issues/6759 Changelog: Add paginated API ListInstallers, deprecate GetInstallers
61 lines
1.9 KiB
Go
61 lines
1.9 KiB
Go
// Teleport
|
|
// Copyright (C) 2025 Gravitational, Inc.
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU Affero General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
package cache
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/gravitational/teleport/api/types"
|
|
)
|
|
|
|
func TestInstallers(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
p := newTestPack(t, ForAuth)
|
|
t.Cleanup(p.Close)
|
|
t.Run("GetInstallers", func(t *testing.T) {
|
|
testResources(t, p, testFuncs[types.Installer]{
|
|
newResource: func(name string) (types.Installer, error) {
|
|
return types.NewInstallerV1(name, "test.sh")
|
|
},
|
|
create: p.clusterConfigS.SetInstaller,
|
|
list: getAllAdapter(p.clusterConfigS.GetInstallers),
|
|
cacheList: getAllAdapter(p.cache.GetInstallers),
|
|
deleteAll: func(ctx context.Context) error {
|
|
return p.clusterConfigS.DeleteAllInstallers(ctx)
|
|
},
|
|
}, withSkipPaginationTest())
|
|
})
|
|
|
|
t.Run("ListInstallers", func(t *testing.T) {
|
|
testResources(t, p, testFuncs[types.Installer]{
|
|
newResource: func(name string) (types.Installer, error) {
|
|
return types.NewInstallerV1(name, "test.sh")
|
|
},
|
|
create: p.clusterConfigS.SetInstaller,
|
|
list: p.clusterConfigS.ListInstallers,
|
|
Range: p.clusterConfigS.RangeInstallers,
|
|
cacheList: p.cache.ListInstallers,
|
|
cacheRange: p.cache.RangeInstallers,
|
|
deleteAll: func(ctx context.Context) error {
|
|
return p.clusterConfigS.DeleteAllInstallers(ctx)
|
|
},
|
|
})
|
|
})
|
|
}
|