Documentation
¶
Index ¶
- Variables
- func AddFullLicense(t *testing.T, client *codersdk.Client) codersdk.License
- func AddLicense(t *testing.T, client *codersdk.Client, options LicenseOptions) codersdk.License
- func CreateOrganization(t *testing.T, client *codersdk.Client, opts CreateOrganizationOptions, ...) codersdk.Organization
- func GenerateLicense(t *testing.T, options LicenseOptions) string
- func New(t *testing.T, options *Options) (*codersdk.Client, codersdk.CreateFirstUserResponse)
- func NewExternalProvisionerDaemon(t testing.TB, client *codersdk.Client, org uuid.UUID, tags map[string]string) io.Closer
- func NewExternalProvisionerDaemonTerraform(t testing.TB, client *codersdk.Client, org uuid.UUID, tags map[string]string) io.Closer
- func NewWithAPI(t *testing.T, options *Options) (*codersdk.Client, io.Closer, *coderd.API, codersdk.CreateFirstUserResponse)
- func NewWithDatabase(t *testing.T, options *Options) (*codersdk.Client, database.Store, codersdk.CreateFirstUserResponse)
- type CreateOrganizationOptions
- type LicenseOptions
- func (opts *LicenseOptions) Expired(now time.Time) *LicenseOptions
- func (opts *LicenseOptions) Feature(name codersdk.FeatureName, value int64) *LicenseOptions
- func (opts *LicenseOptions) FutureTerm(now time.Time) *LicenseOptions
- func (opts *LicenseOptions) Generate(t *testing.T) string
- func (opts *LicenseOptions) GracePeriod(now time.Time) *LicenseOptions
- func (opts *LicenseOptions) UserLimit(limit int64) *LicenseOptions
- func (opts *LicenseOptions) Valid(now time.Time) *LicenseOptions
- type Options
- type ProxyOptions
- type WorkspaceProxy
Constants ¶
This section is empty.
Variables ¶
var (
Keys = map[string]ed25519.PublicKey{}
)
Functions ¶
func AddFullLicense ¶
AddFullLicense generates a license with all features enabled.
func AddLicense ¶
AddLicense generates a new license with the options provided and inserts it.
func CreateOrganization ¶ added in v2.14.0
func CreateOrganization(t *testing.T, client *codersdk.Client, opts CreateOrganizationOptions, mutators ...func(*codersdk.CreateOrganizationRequest)) codersdk.Organization
func GenerateLicense ¶
func GenerateLicense(t *testing.T, options LicenseOptions) string
GenerateLicense returns a signed JWT using the test key.
func NewExternalProvisionerDaemon ¶ added in v2.14.0
func NewExternalProvisionerDaemon(t testing.TB, client *codersdk.Client, org uuid.UUID, tags map[string]string) io.Closer
NewExternalProvisionerDaemon runs an external provisioner daemon in a goroutine and returns a closer to stop it. The echo provisioner is used here. This is the default provisioner for tests and should be fine for most use cases. If you need to test terraform-specific behaviors, use NewExternalProvisionerDaemonTerraform instead.
func NewExternalProvisionerDaemonTerraform ¶ added in v2.18.2
func NewExternalProvisionerDaemonTerraform(t testing.TB, client *codersdk.Client, org uuid.UUID, tags map[string]string) io.Closer
NewExternalProvisionerDaemonTerraform runs an external provisioner daemon in a goroutine and returns a closer to stop it. The terraform provisioner is used here. Avoid using this unless you need to test terraform-specific behaviors!
func NewWithAPI ¶
Types ¶
type CreateOrganizationOptions ¶ added in v2.14.0
type CreateOrganizationOptions struct { // IncludeProvisionerDaemon will spin up an external provisioner for the organization. // This requires enterprise and the feature 'codersdk.FeatureExternalProvisionerDaemons' IncludeProvisionerDaemon bool }
type LicenseOptions ¶
type LicenseOptions struct { AccountType string AccountID string DeploymentIDs []string Trial bool FeatureSet codersdk.FeatureSet AllFeatures bool // GraceAt is the time at which the license will enter the grace period. GraceAt time.Time // ExpiresAt is the time at which the license will hard expire. // ExpiresAt should always be greater then GraceAt. ExpiresAt time.Time // NotBefore is the time at which the license becomes valid. If set to the // zero value, the `nbf` claim on the license is set to 1 minute in the // past. NotBefore time.Time Features license.Features }
LicenseOptions is used to generate a license for testing. It supports the builder pattern for easy customization.
func (*LicenseOptions) Expired ¶ added in v2.14.0
func (opts *LicenseOptions) Expired(now time.Time) *LicenseOptions
func (*LicenseOptions) Feature ¶ added in v2.14.0
func (opts *LicenseOptions) Feature(name codersdk.FeatureName, value int64) *LicenseOptions
func (*LicenseOptions) FutureTerm ¶ added in v2.14.3
func (opts *LicenseOptions) FutureTerm(now time.Time) *LicenseOptions
func (*LicenseOptions) Generate ¶ added in v2.14.0
func (opts *LicenseOptions) Generate(t *testing.T) string
func (*LicenseOptions) GracePeriod ¶ added in v2.14.0
func (opts *LicenseOptions) GracePeriod(now time.Time) *LicenseOptions
func (*LicenseOptions) UserLimit ¶ added in v2.14.0
func (opts *LicenseOptions) UserLimit(limit int64) *LicenseOptions
func (*LicenseOptions) Valid ¶ added in v2.14.0
func (opts *LicenseOptions) Valid(now time.Time) *LicenseOptions
type Options ¶
type Options struct { *coderdtest.Options AuditLogging bool BrowserOnly bool EntitlementsUpdateInterval time.Duration SCIMAPIKey []byte UserWorkspaceQuota int ProxyHealthInterval time.Duration LicenseOptions *LicenseOptions DontAddLicense bool DontAddFirstUser bool ReplicaSyncUpdateInterval time.Duration ReplicaErrorGracePeriod time.Duration ExternalTokenEncryption []dbcrypt.Cipher ProvisionerDaemonPSK string }
type ProxyOptions ¶
type ProxyOptions struct { Name string Experiments codersdk.Experiments TLSCertificates []tls.Certificate AppHostname string DisablePathApps bool DerpDisabled bool DerpOnly bool BlockDirect bool // ProxyURL is optional ProxyURL *url.URL // Token is optional. If specified, a new workspace proxy region will not be // created, and the proxy will become a replica of the existing proxy // region. Token string // ReplicaPingCallback is optional. ReplicaPingCallback func(replicas []codersdk.Replica, err string) // FlushStats is optional FlushStats chan chan<- struct{} }
type WorkspaceProxy ¶ added in v2.8.5
func NewWorkspaceProxyReplica ¶ added in v2.8.5
func NewWorkspaceProxyReplica(t *testing.T, coderdAPI *coderd.API, owner *codersdk.Client, options *ProxyOptions) WorkspaceProxy
NewWorkspaceProxyReplica will configure a wsproxy.Server with the given options. The new wsproxy replica will register itself with the given coderd.API instance.
If a token is not provided, a new workspace proxy region is created using the owner client. If a token is provided, the proxy will become a replica of the existing proxy region.