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.
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. |
Click to show internal directories.
Click to hide internal directories.