This package is not in the latest version of its module.
Go to latest Published: Aug 1, 2023 License: AGPL-3.0The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Modules with tagged versions give importers more predictable builds.
When a project reaches major version v1 it is considered stable.
This section is empty.
AppSecurityKey is a 96-byte key used to sign JWTs and encrypt JWEs for workspace app tokens in tests.
AwaitTemplateImportJob awaits for an import job to reach completed status.
AwaitWorkspaceAgents waits for all resources with agents to be connected. If specific agents are provided, it will wait for those agents to be connected but will not fail if other agents are not connected.
AwaitWorkspaceBuildJob waits for a workspace provision job to reach completed status.
CreateAnotherUser creates and authenticates a new user.
CreateFirstUser creates a user with preset credentials and authenticates with the passed in codersdk client.
CreateTemplate creates a template with the "echo" provisioner for compatibility with testing. The name assigned is randomly generated.
CreateTemplateVersion creates a template import provisioner job with the responses provided. It uses the "echo" provisioner for compatibility with testing.
CreateWorkspace creates a workspace for the user and template provided. A random name is generated for it. To customize the defaults, pass a mutator func.
CreateWorkspaceBuild creates a workspace build for the given workspace and transition.
TransitionWorkspace is a convenience method for transitioning a workspace from one state to another.
MustWorkspace is a convenience method for fetching a workspace that should exist.
NewAWSInstanceIdentity returns a metadata client and ID token validator for faking instance authentication for AWS.
NewAzureInstanceIdentity returns a metadata client and ID token validator for faking instance authentication for Azure.
NewGoogleInstanceIdentity returns a metadata client and ID token validator for faking instance authentication for Google Cloud. nolint:revive
NewProvisionerDaemon launches a provisionerd instance configured to work well with coderd testing. It registers the "echo" provisioner for quick testing.
NewWithAPI constructs an in-memory API instance and returns a client to talk to it. Most tests never need a reference to the API, but AuthorizationTest in this module uses it. Do not expose the API or wrath shall descend upon thee.
NewWithProvisionerCloser returns a client as well as a handle to close the provisioner. This is a temporary function while work is done to standardize how provisioners are registered with coderd. The option to include a provisioner is set to true for convenience.
RequestGitAuthCallback makes a request with the proper OAuth2 state cookie to the git auth callback endpoint.
UpdateTemplateVersion creates a new template version with the "echo" provisioner and associates it with the given templateID.
FakeAuthorizer is an Authorizer that always returns the same error.
PreparedRecorder is the prepared version of the RecordingAuthorizer. It records the Authorize() calls to the original recorder. If the caller uses CompileToSQL, all recording stops. This is to support parity between memory and SQL backed dbs.
RBACAsserter is a helper for asserting that the correct RBAC checks are performed. This struct is tied to a given user, and only authorizes calls for this user are checked.
AssertRBAC returns an RBACAsserter for the given user. This asserter will allow asserting that the correct RBAC checks are performed for the given user. All checks that are not run against this user will be ignored.
AllCalls is for debugging. If you are not sure where calls are coming from, call this and use a debugger or print them. They have small callstacks on them to help locate the 'Authorize' call. Only calls to Authorize by the given subject will be returned. Note that duplicate rbac calls are handled by the rbac.Cacher(), but will be recorded twice. So AllCalls() returns calls regardless if they were returned from the cached or not.
AssertChecked will assert a given rbac check was performed. It does not care about order of checks, or any other checks. This is useful when you do not care about asserting every check that was performed.
AssertInOrder must be called in the correct order of authz checks. If the objects or actions are not in the correct order, the test will fail.
Reset will clear all previously recorded authz calls. This is helpful when wanting to ignore checks run in test setup.
RecordingAuthorizer wraps any rbac.Authorizer and records all Authorize() calls made. This is useful for testing as these calls can later be asserted.
AllAsserted returns an error if all calls to Authorize() have not been asserted and checked. This is useful for testing to ensure that all Authorize() calls are checked in the unit test.
AssertActor asserts in order. If the order of authz calls does not match, this will fail.
AssertOutOfOrder asserts that the given actor performed the given action on the given objects. It does not care about the order of the calls. When marking authz calls as asserted, it will mark the first matching calls first.
Pair is on the RecordingAuthorizer to be easy to find and keep the pkg interface smaller.
Reset clears the recorded Authorize() calls.
| ? | : This menu |
| / | : Search site |
| f or F | : Jump to |
| y or Y | : Canonical URL |