e2e

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package e2e provides a few utilities for use in unit tests.

Example (Config)
package main

import (
	"fmt"
	"reflect"

	"github.com/supatype/server/internal/conf"
	"github.com/supatype/server/internal/e2e"
)

func main() {
	testCfgPath := "../../hack/test.env"
	testCfg := e2e.Must(conf.LoadGlobal(testCfgPath))
	globalCfg := e2e.Must(e2e.Config())

	if reflect.DeepEqual(testCfg, globalCfg) {
		fmt.Println("e2e.Config is equal to the config in hack/test.env")
	} else {
		fmt.Println("e2e.Config loaded an unknown config file")
	}

}
Output:
e2e.Config is equal to the config in hack/test.env
Example (Conn)
package main

import (
	"fmt"

	"github.com/supatype/server/internal/e2e"
)

func main() {
	globalCfg := e2e.Must(e2e.Config())
	conn := e2e.Must(e2e.Conn(globalCfg))
	if conn != nil {
		fmt.Println("e2e.Conn connection returned using hack/test.env")
	}

}
Output:
e2e.Conn connection returned using hack/test.env

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Config

func Config() (*conf.GlobalConfiguration, error)

Config calls conf.LoadGlobal using GetConfigPath().

func Conn

func Conn(globalCfg *conf.GlobalConfiguration) (*storage.Connection, error)

Conn returns a connection for the given config.

func GetConfigPath

func GetConfigPath() string

GetConfigPath returns the path for the "/hack/test.env" config file.

func GetProjectRoot

func GetProjectRoot() string

GetProjectRoot returns the path to the root of the project. This may be used to locate files without needing the relative path from a given test.

func Must

func Must[T any](res T, err error) T

Must may be used by Config and Conn, i.e.:

cfg := e2e.Must(e2e.Config())
conn := e2e.Must(e2e.Conn(cfg))

Types

This section is empty.

Directories

Path Synopsis
Package e2eapi provides utilities for end-to-end testing the api.
Package e2eapi provides utilities for end-to-end testing the api.
Package e2ehooks provides utilities for end-to-end testing of hooks.
Package e2ehooks provides utilities for end-to-end testing of hooks.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL