Documentation
¶
Overview ¶
Example (InstallItemFailure) ¶
// Override execCommand and checkStatus with our fake versions
execCommand = fakeExecCommand
statusCheckStatus = fakeCheckStatus
runCommand = fakeRunCommand
download.SetConfig(downloadCfg)
defer func() {
execCommand = origExec
statusCheckStatus = origCheckStatus
runCommand = origRunCommand
}()
// Set shared testing variables
cachePath := "testdata/"
urlPackages := "https://example.com/"
//
// Msi
//
msiItem.DisplayName = statusActionError
//
// Run Install
installItem(msiItem, urlPackages, cachePath)
Output: Installing msi for _gorilla_dev_action_error_ _gorilla_dev_action_error_ 1.2.3 Installation FAILED
Example (InstallItemSuccess) ¶
// Override execCommand and checkStatus with our fake versions
execCommand = fakeExecCommand
statusCheckStatus = fakeCheckStatus
runCommand = fakeRunCommand
download.SetConfig(downloadCfg)
defer func() {
execCommand = origExec
statusCheckStatus = origCheckStatus
runCommand = origRunCommand
}()
// Set shared testing variables
cachePath := "testdata/"
urlPackages := "https://example.com/"
//
// Msi
//
msiItem.DisplayName = statusActionNoError
//
// Run Install
installItem(msiItem, urlPackages, cachePath)
Output: Installing msi for _gorilla_dev_action_noerror_ _gorilla_dev_action_noerror_ 1.2.3 Installation SUCCESSFUL
Example (RunCommand) ¶
Example_runCommand tests the output when running a command in debug
// Temp directory for logging
logTmp, _ := ioutil.TempDir("", "gorilla-installer_test")
// Setup a testing Configuration struct with debug mode
cfgVerbose := config.Configuration{
Debug: true,
Verbose: true,
AppDataPath: logTmp,
}
// Start gorillalog in debug mode
gorillalog.NewLog(cfgVerbose)
// Override execCommand with our fake version
execCommand = fakeExecCommand
defer func() { execCommand = origExec }()
// Set up what we expect
testCmd := "Command Test!"
testArgs := []string{"arg1", "arg2"}
// Run the function
runCommand(testCmd, testArgs)
Output: command: Command Test! [arg1 arg2] Command Output: -------------------- [Command Test! arg1 arg2] --------------------
Example (UninstallItemFailure) ¶
// Override execCommand and checkStatus with our fake versions
execCommand = fakeExecCommand
statusCheckStatus = fakeCheckStatus
runCommand = fakeRunCommand
download.SetConfig(downloadCfg)
defer func() {
execCommand = origExec
statusCheckStatus = origCheckStatus
runCommand = origRunCommand
}()
// Set shared testing variables
cachePath := "testdata/"
urlPackages := "https://example.com/"
//
// Msi
//
msiItem.DisplayName = statusActionError
// Run Install
uninstallItem(msiItem, urlPackages, cachePath)
Output: Uninstalling msi for _gorilla_dev_action_error_ _gorilla_dev_action_error_ 1.2.3 Uninstallation FAILED
Example (UninstallItemSuccess) ¶
// Override execCommand and checkStatus with our fake versions
execCommand = fakeExecCommand
statusCheckStatus = fakeCheckStatus
runCommand = fakeRunCommand
download.SetConfig(downloadCfg)
defer func() {
execCommand = origExec
statusCheckStatus = origCheckStatus
runCommand = origRunCommand
}()
// Set shared testing variables
cachePath := "testdata/"
urlPackages := "https://example.com/"
//
// Msi
//
msiItem.DisplayName = statusActionNoError
// Run Install
uninstallItem(msiItem, urlPackages, cachePath)
Output: Uninstalling msi for _gorilla_dev_action_noerror_ _gorilla_dev_action_noerror_ 1.2.3 Uninstallation SUCCESSFUL
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.