Documentation
¶
Overview ¶
testd that makes easier to write integration tests that depends on runnings daemons/services.
Create a Testd instance, informing where you want the logs to be saved, the command to execute and its arguments.
daemon, err := testd.New("./tests/debug/daemon.log", "daemon", "arg1", "arg2")
Do your testing, that depends on the daemon being running. When you are done testing, just call the Stop method.
err := daemon.Stop()
Remember to do proper error handling, both on New and Stop.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Testd ¶
type Testd struct {
// contains filtered or unexported fields
}
func New ¶
New creates a new testd instance. It will call exec.Command using the given name and arg and start the daemon. All logs (stdout and stderr) of the daemon will be saved at the given logFilePath. If a directory on logFilePath does not exist, it will attempt to create the directory for you. You must always call Testd.Stop, even when you know that the daemon already exited for some reason.