mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-03-13 19:01:09 -04:00
* Remove `make updatedeps` from Travis build. We'll follow up with more specific plans around dependency updating in subsequent PRs. * Update all `make` targets to set `GO15VENDOREXPERIMENT=1` and to filter out `/vendor/` from `./...` where appropriate. * Temporarily remove `vet` from the `make test` target until we can figure out how to get it to not vet `vendor/`. (Initial experimentation failed to yield the proper incantation.) Everything is pinned to current master, with the exception of: * Azure/azure-sdk-for-go which is pinned before the breaking change today * aws/aws-sdk-go which is pinned to the most recent tag The documentation still needs to be updated, which we can do in a follow up PR. The goal here is to unblock release.
49 lines
1.1 KiB
Markdown
49 lines
1.1 KiB
Markdown
|
|
# winrmtest
|
|
|
|
An in-progress testing package to compliment the [masterzen/winrm](https://github.com/masterzen/winrm) Go-based winrm library.
|
|
|
|
My primary use-case for this is for [dylanmei/packer-communicator-winrm](https://github.com/dylanmei/packer-communicator-winrm), a [Packer](http://packer.io) communicator plugin for interacting with machines using Windows Remote Management.
|
|
|
|
## Example Use
|
|
|
|
A fictitious "Windows tools" package.
|
|
|
|
```
|
|
|
|
package wintools
|
|
|
|
import (
|
|
"io"
|
|
"testing"
|
|
"github.com/dylanmei/winrmtest"
|
|
)
|
|
|
|
func Test_empty_temp_directory(t *testing.T) {
|
|
r := winrmtest.NewRemote()
|
|
defer r.Close()
|
|
|
|
r.CommandFunc(wimrmtest.MatchText("dir C:\Temp"), func(out, err io.Writer) int {
|
|
out.Write([]byte(` Volume in drive C is Windows 2012 R2
|
|
Volume Serial Number is XXXX-XXXX
|
|
|
|
Directory of C:\
|
|
|
|
File Not Found`))
|
|
return 0
|
|
})
|
|
|
|
lister := NewDirectoryLister(r.Host, r.Port)
|
|
list, _ := lister.TempDirectory()
|
|
|
|
if count := len(list.Dirs()); count != 0 {
|
|
t.Errorf("Expected 0 directories but found %d.\n", count)
|
|
}
|
|
|
|
if count := len(list.Files()); count != 0 {
|
|
t.Errorf("Expected 0 files but found %d.\n", count)
|
|
}
|
|
}
|
|
```
|
|
|