mirror of
https://github.com/gravitational/teleport.git
synced 2026-11-04 02:21:02 +08:00
* Compile binaries for access plugin tests * Fix PD test asserts for newer Teleport versions * Unpin role from V6 in access plugin tests * Remove license from OSS plugins tests We now run tests against OSS Teleport in the OSS repo, and against Enterprise Teleport in the E repo. So the assumption that CI always needs an enterprise license is incorrect. * Only compile the required binaries
55 lines
1.4 KiB
Go
55 lines
1.4 KiB
Go
/*
|
|
Copyright 2021 Gravitational, Inc.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
package integration
|
|
|
|
import (
|
|
"github.com/gravitational/trace"
|
|
|
|
"github.com/gravitational/teleport/api/types"
|
|
)
|
|
|
|
type Bootstrap struct {
|
|
resources []types.Resource
|
|
}
|
|
|
|
func (bootstrap *Bootstrap) Add(resource types.Resource) {
|
|
bootstrap.resources = append(bootstrap.resources, resource)
|
|
}
|
|
|
|
func (bootstrap *Bootstrap) Resources() []types.Resource {
|
|
return bootstrap.resources
|
|
}
|
|
|
|
func (bootstrap *Bootstrap) AddUserWithRoles(name string, roles ...string) (types.User, error) {
|
|
user, err := types.NewUser(name)
|
|
if err != nil {
|
|
return nil, trace.Wrap(err)
|
|
}
|
|
user.SetRoles(roles)
|
|
bootstrap.Add(user)
|
|
return user, nil
|
|
}
|
|
|
|
func (bootstrap *Bootstrap) AddRole(name string, spec types.RoleSpecV6) (types.Role, error) {
|
|
role, err := types.NewRole(name, spec)
|
|
if err != nil {
|
|
return nil, trace.Wrap(err)
|
|
}
|
|
bootstrap.Add(role)
|
|
return role, nil
|
|
}
|