Files
teleport/lib/cache/git_server_test.go
T
Luke Okraszewski ddb7a431c0 [cache_test] remove test pack timeout (#60626)
This timeout can make tests flaky depending on the scheduler and
cpu contention. The tests cannot proceed without the test pack,
so for this case simply block until ready. If for any reason
the watcher fails to start the top level harness timeout will
terminate it.
2025-10-28 09:25:23 +00:00

60 lines
1.7 KiB
Go

/*
* Teleport
* Copyright (C) 2024 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/trace"
"github.com/stretchr/testify/require"
"github.com/gravitational/teleport/api/types"
)
func TestGitServers(t *testing.T) {
t.Parallel()
p, err := newPack(t, ForAuth)
require.NoError(t, err)
t.Cleanup(p.Close)
testResources(t, p, testFuncs[types.Server]{
newResource: func(name string) (types.Server, error) {
return types.NewGitHubServerWithName(name,
types.GitHubServerMetadata{
Integration: name,
Organization: name,
})
},
create: func(ctx context.Context, server types.Server) error {
_, err := p.gitServers.CreateGitServer(ctx, server)
return trace.Wrap(err)
},
list: p.gitServers.ListGitServers,
update: func(ctx context.Context, server types.Server) error {
_, err := p.gitServers.UpdateGitServer(ctx, server)
return trace.Wrap(err)
},
deleteAll: p.gitServers.DeleteAllGitServers,
cacheList: p.cache.ListGitServers,
cacheGet: p.cache.GetGitServer,
})
}