Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithAdminCredentials ¶
func WithAdminCredentials(username, password, email string) testcontainers.CustomizeRequestOption
WithAdminCredentials sets the admin username, password, and email for the Forgejo instance. These credentials are used to create an admin user after the container is ready.
func WithConfig ¶
func WithConfig(section, key, value string) testcontainers.CustomizeRequestOption
WithConfig sets a Forgejo configuration value using the FORGEJO__section__key environment variable format. See https://forgejo.org/docs/latest/admin/config-cheat-sheet/ for available options.
Types ¶
type Container ¶
type Container struct {
testcontainers.Container
// contains filtered or unexported fields
}
Container represents the Forgejo container type used in the module
func Run ¶
func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (*Container, error)
Run creates an instance of the Forgejo container type
Example ¶
// runForgejoContainer {
ctx := context.Background()
forgejoContainer, err := forgejo.Run(ctx, "codeberg.org/forgejo/forgejo:11")
defer func() {
if err := testcontainers.TerminateContainer(forgejoContainer); err != nil {
log.Printf("failed to terminate container: %s", err)
}
}()
if err != nil {
log.Printf("failed to start container: %s", err)
return
}
// }
state, err := forgejoContainer.State(ctx)
if err != nil {
log.Printf("failed to get container state: %s", err)
return
}
fmt.Println(state.Running)
Output: true
func (*Container) AdminPassword ¶
AdminPassword returns the admin password for the Forgejo instance.
func (*Container) AdminUsername ¶
AdminUsername returns the admin username for the Forgejo instance.
func (*Container) ConnectionString ¶
ConnectionString returns the HTTP URL for the Forgejo instance